Skip to content

Commit 8eb7743

Browse files
committed
Fix knative-extensions#387 Panic if Redis client returns use of closed network connection
1 parent 4fd4e47 commit 8eb7743

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pkg/source/adapter/adapter.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,9 @@ func (a *Adapter) processEntry(ctx context.Context, conn redis.Conn, streamName
183183
reply, err := conn.Do("XREADGROUP", "GROUP", groupName, consumerName, "COUNT", count, "BLOCK", blockms, "STREAMS", streamName, xreadID)
184184
if err != nil {
185185
a.logger.Error("Cannot read from stream", zap.Error(err))
186+
if strings.Contains(strings.ToLower(err.Error()), "use of closed network connection") { // Redis has probably been shut down
187+
panic("Redis has been shut down")
188+
}
186189
if !isShuttingDown {
187190
time.Sleep(1 * time.Second)
188191
}

0 commit comments

Comments
 (0)