From b4b68535fad4159be3e17c1b64c646fba7b0acad Mon Sep 17 00:00:00 2001 From: ferglor <19188060+ferglor@users.noreply.github.com> Date: Mon, 18 Sep 2023 10:23:09 +0100 Subject: [PATCH] Read the length of pending records while locked (#10663) --- .../ocr2/plugins/ocr2keeper/evm21/upkeepstate/store.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/core/services/ocr2/plugins/ocr2keeper/evm21/upkeepstate/store.go b/core/services/ocr2/plugins/ocr2keeper/evm21/upkeepstate/store.go index cd123212376..34bd6822d69 100644 --- a/core/services/ocr2/plugins/ocr2keeper/evm21/upkeepstate/store.go +++ b/core/services/ocr2/plugins/ocr2keeper/evm21/upkeepstate/store.go @@ -132,9 +132,8 @@ func (u *upkeepStateStore) Start(pctx context.Context) error { } func (u *upkeepStateStore) flush(ctx context.Context) { - cloneRecords := make([]persistedStateRecord, len(u.pendingRecords)) - u.mu.Lock() + cloneRecords := make([]persistedStateRecord, len(u.pendingRecords)) copy(cloneRecords, u.pendingRecords) u.pendingRecords = []persistedStateRecord{} u.mu.Unlock()