lib/message_bus/backends/redis.rb in message_bus-2.0.5 vs lib/message_bus/backends/redis.rb in message_bus-2.0.6
- old
+ new
@@ -43,11 +43,11 @@
def new_redis_connection
::Redis.new(@redis_config)
end
def after_fork
- pub_redis.client.reconnect
+ pub_redis.disconnect!
end
def redis_channel_name
db = @redis_config[:db] || 0
"_message_bus_#{db}"
@@ -268,10 +268,11 @@
highest_id
end
def global_unsubscribe
if @redis_global
- pub_redis.publish(redis_channel_name, UNSUB_MESSAGE)
+ # new connection to avoid deadlock
+ new_redis_connection.publish(redis_channel_name, UNSUB_MESSAGE)
@redis_global.disconnect
@redis_global = nil
end
end