From 9471f2eb833225310e90da93148e89650f15edfd Mon Sep 17 00:00:00 2001 From: ferglor <19188060+ferglor@users.noreply.github.com> Date: Tue, 14 Nov 2023 15:12:12 +0000 Subject: [PATCH] Attempt to fix streams lookup race condition (#11284) --- .../ocr2/plugins/ocr2keeper/evm21/streams_lookup.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/core/services/ocr2/plugins/ocr2keeper/evm21/streams_lookup.go b/core/services/ocr2/plugins/ocr2keeper/evm21/streams_lookup.go index fb2821a74b7..af7ff42b930 100644 --- a/core/services/ocr2/plugins/ocr2keeper/evm21/streams_lookup.go +++ b/core/services/ocr2/plugins/ocr2keeper/evm21/streams_lookup.go @@ -151,11 +151,13 @@ func (r *EvmRegistry) streamsLookup(ctx context.Context, checkResults []ocr2keep var wg sync.WaitGroup for i, lookup := range lookups { - i := i wg.Add(1) - r.threadCtrl.Go(func(ctx context.Context) { - r.doLookup(ctx, &wg, lookup, i, checkResults, lggr) - }) + func(i int, lookup *StreamsLookup) { + r.threadCtrl.Go(func(ctx context.Context) { + r.doLookup(ctx, &wg, lookup, i, checkResults, lggr) + }) + }(i, lookup) + } wg.Wait()