graph/db: let ForEachNodeCacheable take a context

This commit is contained in:
Elle Mouton committed 2025-07-08 15:10:30 +02:00
1 parent 85fda8b926
commit f05ef2db97
5 files changed
+11 -12

No files matched your search

+3 -2
View File
@@ -1433,6 +1433,7 @@ func TestGraphTraversal(t *testing.T) {
// working correctly.
func TestGraphTraversalCacheable(t *testing.T) {
t.Parallel()
ctx := context.Background()
graph := MakeTestGraph(t)
@@ -1458,7 +1459,7 @@ func TestGraphTraversalCacheable(t *testing.T) {
// iterating over each node, once again if the map is empty that
// indicates that all edges have properly been reached.
var nodes []route.Vertex
err = graph.ForEachNodeCacheable(func(node route.Vertex,
err = graph.ForEachNodeCacheable(ctx, func(node route.Vertex,
features *lnwire.FeatureVector) error {
delete(nodeMap, node)
@@ -4226,7 +4227,7 @@ func BenchmarkForEachChannel(b *testing.B) {
)
var nodes []route.Vertex
err := graph.ForEachNodeCacheable(func(node route.Vertex,
err := graph.ForEachNodeCacheable(ctx, func(node route.Vertex,
vector *lnwire.FeatureVector) error {
nodes = append(nodes, node)