graphdb: thread topology update context

This commit is contained in:
Elle Mouton committed 2026-02-25 16:11:47 +02:00
1 parent 0bb0d66952
commit 262e9208b9
2 files changed
+14 -9

No files matched your search

+5 -5
View File
@@ -202,11 +202,11 @@ func (c *ChannelGraph) notifyTopologyChange(topologyDiff *TopologyChange) {
//
// NOTE: must be run inside goroutine and must only ever be called from within
// handleTopologySubscriptions.
func (c *ChannelGraph) handleTopologyUpdate(update any) {
func (c *ChannelGraph) handleTopologyUpdate(ctx context.Context, update any) {
defer c.wg.Done()
topChange := &TopologyChange{}
err := c.addToTopologyChange(topChange, update)
err := c.addToTopologyChange(ctx, topChange, update)
if err != nil {
log.Errorf("unable to update topology change notification: %v",
err)
@@ -376,8 +376,8 @@ type ChannelEdgeUpdate struct {
// constitutes. This function will also fetch any required auxiliary
// information required to create the topology change update from the graph
// database.
func (c *ChannelGraph) addToTopologyChange(update *TopologyChange,
msg any) error {
func (c *ChannelGraph) addToTopologyChange(ctx context.Context,
update *TopologyChange, msg any) error {
switch m := msg.(type) {
@@ -414,7 +414,7 @@ func (c *ChannelGraph) addToTopologyChange(update *TopologyChange,
// in order to get the information concerning which nodes are
// being connected.
edgeInfo, _, _, err := c.FetchChannelEdgesByID(
context.TODO(), m.ChannelID,
ctx, m.ChannelID,
)
if err != nil {
return fmt.Errorf("unable fetch channel edge: %w", err)