Skip to content

Commit

Permalink
Merge pull request #1 from pace/remove-consumption-stoppage
Browse files Browse the repository at this point in the history
Remove consumption stoppage when heartbeat error limit is reached
  • Loading branch information
jpwenzel authored Aug 27, 2024
2 parents 93f1717 + c4fae4f commit b3db08d
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,20 +158,11 @@ func (connection *redisConnection) heartbeat(errChan chan<- error) {

errorCount++

if errorCount >= HeartbeatErrorLimit {
// reached error limit
connection.StopAllConsuming()
// Clients reading from errChan need to see this error
// This allows them to shut themselves down
// Therefore we block adding it to errChan to ensure delivery
errChan <- &HeartbeatError{RedisErr: err, Count: errorCount}
return
} else {
select { // try to add error to channel, but don't block
case errChan <- &HeartbeatError{RedisErr: err, Count: errorCount}:
default:
}
select { // try to add error to channel, but don't block
case errChan <- &HeartbeatError{RedisErr: err, Count: errorCount}:
default:
}

// keep trying until we hit the limit
}
}
Expand Down

0 comments on commit b3db08d

Please sign in to comment.