提交 4ac6cfef 编写于 作者: P Pratik Naik

Remove all the existing connections on redis reconnect

上级 426fe543
......@@ -100,6 +100,10 @@ def statistics
end
def handle_exception
close_connection
end
def close_connection
logger.error "Closing connection"
@websocket.close
......
......@@ -24,7 +24,18 @@ def worker_pool
end
def pubsub
@pubsub ||= EM::Hiredis.connect(@redis_config[:url]).pubsub
@pubsub ||= redis.pubsub
end
def redis
@redis ||= begin
redis = EM::Hiredis.connect(@redis_config[:url])
redis.on(:reconnected) do
logger.info "[ActionCable] Redis reconnected. Closing all the open connections."
@connections.map &:close_connection
end
redis
end
end
def remote_connections
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册