From 8eb7743d9938cb1cb95220bf753795bd65e75e44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Colin=20de=20Verdi=C3=A8re?= Date: Mon, 21 Oct 2024 13:07:49 +0200 Subject: [PATCH] Fix #387 Panic if Redis client returns use of closed network connection --- pkg/source/adapter/adapter.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/source/adapter/adapter.go b/pkg/source/adapter/adapter.go index 2dc34eec2..ad617fe5a 100644 --- a/pkg/source/adapter/adapter.go +++ b/pkg/source/adapter/adapter.go @@ -183,6 +183,9 @@ func (a *Adapter) processEntry(ctx context.Context, conn redis.Conn, streamName reply, err := conn.Do("XREADGROUP", "GROUP", groupName, consumerName, "COUNT", count, "BLOCK", blockms, "STREAMS", streamName, xreadID) if err != nil { a.logger.Error("Cannot read from stream", zap.Error(err)) + if strings.Contains(strings.ToLower(err.Error()), "use of closed network connection") { // Redis has probably been shut down + panic("Redis has been shut down") + } if !isShuttingDown { time.Sleep(1 * time.Second) }