routing+server: let ForAllOutgoingChannels take a context
And so, remove a previously added context.TODO
This commit is contained in:
3 files changed
+10
-9
No files matched your search
@@ -40,8 +40,9 @@ type Manager struct {
|
||||
|
||||
// ForAllOutgoingChannels is required to iterate over all our local
|
||||
// channels. The ChannelEdgePolicy parameter may be nil.
|
||||
ForAllOutgoingChannels func(cb func(*models.ChannelEdgeInfo,
|
||||
*models.ChannelEdgePolicy) error) error
|
||||
ForAllOutgoingChannels func(ctx context.Context,
|
||||
cb func(*models.ChannelEdgeInfo,
|
||||
*models.ChannelEdgePolicy) error) error
|
||||
|
||||
// FetchChannel is used to query local channel parameters. Optionally an
|
||||
// existing db tx can be supplied.
|
||||
@@ -151,7 +152,7 @@ func (r *Manager) UpdatePolicy(ctx context.Context,
|
||||
// Next, we'll loop over all the outgoing channels the router knows of.
|
||||
// If we have a filter then we'll only collect those channels, otherwise
|
||||
// we'll collect them all.
|
||||
err := r.ForAllOutgoingChannels(processChan)
|
||||
err := r.ForAllOutgoingChannels(ctx, processChan)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -123,8 +123,9 @@ func TestManager(t *testing.T) {
|
||||
return nil
|
||||
}
|
||||
|
||||
forAllOutgoingChannels := func(cb func(*models.ChannelEdgeInfo,
|
||||
*models.ChannelEdgePolicy) error) error {
|
||||
forAllOutgoingChannels := func(_ context.Context,
|
||||
cb func(*models.ChannelEdgeInfo,
|
||||
*models.ChannelEdgePolicy) error) error {
|
||||
|
||||
for _, c := range channelSet {
|
||||
if err := cb(c.edgeInfo, ¤tPolicy); err != nil {
|
||||
|
||||
@@ -1252,10 +1252,9 @@ func newServer(ctx context.Context, cfg *Config, listenAddrs []net.Addr,
|
||||
s.localChanMgr = &localchans.Manager{
|
||||
SelfPub: nodeKeyDesc.PubKey,
|
||||
DefaultRoutingPolicy: cc.RoutingPolicy,
|
||||
ForAllOutgoingChannels: func(cb func(*models.ChannelEdgeInfo,
|
||||
*models.ChannelEdgePolicy) error) error {
|
||||
|
||||
ctx := context.TODO()
|
||||
ForAllOutgoingChannels: func(ctx context.Context,
|
||||
cb func(*models.ChannelEdgeInfo,
|
||||
*models.ChannelEdgePolicy) error) error {
|
||||
|
||||
return s.graphDB.ForEachNodeChannel(ctx, selfVertex,
|
||||
func(c *models.ChannelEdgeInfo,
|
||||
|
||||
Reference in new issue
Block a user