diff --git a/core/commands/routing.go b/core/commands/routing.go index 99aa4a78df75..1f96c4deaadd 100644 --- a/core/commands/routing.go +++ b/core/commands/routing.go @@ -81,10 +81,9 @@ var findProvidersRoutingCmd = &cmds.Command{ ctx, cancel := context.WithCancel(req.Context) ctx, events := routing.RegisterForQueryEvents(ctx) - pchan := n.Routing.FindProvidersAsync(ctx, c, numProviders) - go func() { defer cancel() + pchan := n.Routing.FindProvidersAsync(ctx, c, numProviders) for p := range pchan { np := p routing.PublishQueryEvent(ctx, &routing.QueryEvent{