lib/rails_failover/redis/handler.rb in rails_failover-0.5.8 vs lib/rails_failover/redis/handler.rb in rails_failover-0.5.9
- old
+ new
@@ -206,10 +206,14 @@
# Therefore try to acquire the lock
def soft_disconnect(redis, client, role)
has_lock = redis.mon_try_enter
if !has_lock
- client.connection.shutdown_socket
+ begin
+ client.connection.shutdown_socket
+ rescue => e
+ logger&.warn "Redis shutdown_socket for (#{role}) failed with #{e.class} '#{e.message}'"
+ end
waiting_since = Process.clock_gettime(Process::CLOCK_MONOTONIC)
loop do # Keep trying
break if has_lock = redis.mon_try_enter
break if !client.connection.connected? # Disconnected by other thread