From e874b860c07f3ac3e5ca29eed9d5ff8529692d91 Mon Sep 17 00:00:00 2001 From: Freddy Date: Thu, 12 May 2022 17:36:14 -0600 Subject: [PATCH] Actually block when syncing subscriptions (#13066) By changing to use WatchCtx we will actually block for changes to the peering list. WatchCh creates a goroutine to collect errors from WatchCtx and returns immediately. The existing behavior wouldn't result in a tight loop because of the rate limiting in the surrounding function, but it would still lead to more work than is necessary. --- agent/rpc/peering/subscription_manager.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/agent/rpc/peering/subscription_manager.go b/agent/rpc/peering/subscription_manager.go index bd90168d7c..1f59fa4a4f 100644 --- a/agent/rpc/peering/subscription_manager.go +++ b/agent/rpc/peering/subscription_manager.go @@ -134,7 +134,7 @@ func (m *subscriptionManager) syncSubscriptionsAndBlock(ctx context.Context, pee } // Block for any changes to the state store. - ws.WatchCh(ctx) + ws.WatchCtx(ctx) return nil }