graph/db: let ForEachChannelCacheable take a reset param

This commit is contained in:
Elle Mouton
2025-07-11 11:03:22 +02:00
parent b3f3766fe6
commit 13d0bd5ef6
4 changed files with 8 additions and 9 deletions

View File

@@ -182,7 +182,8 @@ func (c *ChannelGraph) populateCache(ctx context.Context) error {
c.graphCache.AddChannel(info, policy1, policy2)
return nil
})
}, func() {},
)
if err != nil {
return err
}

View File

@@ -177,8 +177,8 @@ type V1Store interface { //nolint:interfacebloat
// NOTE: this method is like ForEachChannel but fetches only the data
// required for the graph cache.
ForEachChannelCacheable(cb func(*models.CachedEdgeInfo,
*models.CachedEdgePolicy,
*models.CachedEdgePolicy) error) error
*models.CachedEdgePolicy, *models.CachedEdgePolicy) error,
reset func()) error
// DisabledChannelIDs returns the channel ids of disabled channels.
// A channel is disabled when two of the associated ChanelEdgePolicies

View File

@@ -486,9 +486,8 @@ func forEachChannel(db kvdb.Backend, cb func(*models.ChannelEdgeInfo,
// NOTE: this method is like ForEachChannel but fetches only the data required
// for the graph cache.
func (c *KVStore) ForEachChannelCacheable(cb func(*models.CachedEdgeInfo,
*models.CachedEdgePolicy, *models.CachedEdgePolicy) error) error {
reset := func() {}
*models.CachedEdgePolicy, *models.CachedEdgePolicy) error,
reset func()) error {
return c.db.View(func(tx kvdb.RTx) error {
edges := tx.ReadBucket(edgeBucket)

View File

@@ -1236,10 +1236,9 @@ func (s *SQLStore) ForEachNodeCached(ctx context.Context,
// NOTE: this method is like ForEachChannel but fetches only the data
// required for the graph cache.
func (s *SQLStore) ForEachChannelCacheable(cb func(*models.CachedEdgeInfo,
*models.CachedEdgePolicy,
*models.CachedEdgePolicy) error) error {
*models.CachedEdgePolicy, *models.CachedEdgePolicy) error,
reset func()) error {
reset := func() {}
ctx := context.TODO()
handleChannel := func(db SQLQueries,