1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00

Catch all Redis errors and check for NOREPLICAS, fixes #4495

This commit is contained in:
Mike Perham 2020-06-19 12:10:27 -07:00
parent 66bb4369fb
commit 267b4cc601

View file

@ -96,10 +96,11 @@ module Sidekiq
retryable = true
begin
yield conn
rescue Redis::CommandError => ex
rescue Redis::BaseError => ex
# 2550 Failover can cause the server to become a replica, need
# to disconnect and reopen the socket to get back to the primary.
if retryable && ex.message =~ /READONLY/
# 4495 Use the same logic if we have a "Not enough replicas" error from the primary
if retryable && ex.message =~ /READONLY|NOREPLICAS/
conn.disconnect!
retryable = false
retry