Skip to content

Commit

Permalink
Fix #387 Panic if Redis client returns use of closed network connection
Browse files Browse the repository at this point in the history
  • Loading branch information
tdeverdiere committed Oct 21, 2024
1 parent 4fd4e47 commit 8eb7743
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/source/adapter/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 8eb7743

Please sign in to comment.