From 570203f95e2580f3f6e76a75207aab23a2e1a501 Mon Sep 17 00:00:00 2001 From: Petr Hanzl <84449820+petr-hanzl@users.noreply.github.com> Date: Mon, 22 Apr 2024 11:52:59 +0200 Subject: [PATCH] Allow stopping even if workers result channel is full. (#74) --- db/substate_iterator.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/db/substate_iterator.go b/db/substate_iterator.go index 42e1b62..99a145c 100644 --- a/db/substate_iterator.go +++ b/db/substate_iterator.go @@ -105,7 +105,12 @@ func (i *substateIterator) start(numWorkers int) { errCh <- err return } - resultChs[id] <- transaction + select { + case resultChs[id] <- transaction: + case <-i.stopCh: + return + + } } }