From ce56dffa8f2a84e50ce52f65e0ecb3bc923c6a6b Mon Sep 17 00:00:00 2001 From: Yonas Habteab Date: Thu, 28 Mar 2024 14:52:27 +0100 Subject: [PATCH] `history.Sync`: Don't operate on closed channel --- pkg/icingadb/history/sync.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/icingadb/history/sync.go b/pkg/icingadb/history/sync.go index 943b2373b..4be0e71f9 100644 --- a/pkg/icingadb/history/sync.go +++ b/pkg/icingadb/history/sync.go @@ -144,7 +144,11 @@ func (s Sync) deleteFromRedis(ctx context.Context, key string, input <-chan redi stream := "icinga:history:stream:" + key for { select { - case bulk := <-bulks: + case bulk, ok := <-bulks: + if !ok { + return nil + } + ids := make([]string, len(bulk)) for i := range bulk { ids[i] = bulk[i].ID