autopilot: start threading contexts through

The `GraphSource` interface in the `autopilot` package is directly
implemented by the `graphdb.KVStore` and so we will eventually thread
contexts through to this interface. So in this commit, we start updating
the autopilot system to thread contexts through in preparation for
passing the context through to any calls made to the GraphSource.

Two context.TODOs are added here which will be addressed in follow up
commits.
This commit is contained in:
Elle Mouton
2025-04-09 06:25:29 +02:00
committed by ziggie
parent ca52834795
commit cd4a59071d
13 changed files with 146 additions and 71 deletions

View File

@@ -1,6 +1,7 @@
package autopilot
import (
"context"
"fmt"
"sync"
)
@@ -169,7 +170,9 @@ func betweennessCentrality(g *SimpleGraph, s int, centrality []float64) {
// Refresh recalculates and stores centrality values.
func (bc *BetweennessCentrality) Refresh(graph ChannelGraph) error {
cache, err := NewSimpleGraph(graph)
ctx := context.TODO()
cache, err := NewSimpleGraph(ctx, graph)
if err != nil {
return err
}