From c6ae7165c8e23b6cedde7c986e19d2fc35efb2a8 Mon Sep 17 00:00:00 2001 From: Adin Schmahmann Date: Wed, 8 Nov 2023 01:09:29 -0500 Subject: [PATCH] fix: allow event emitting to happen in parallel with getting the query channel --- core/commands/routing.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/core/commands/routing.go b/core/commands/routing.go index 99aa4a78d..1f96c4dea 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{