mirror of
https://github.com/zulip/zulip.git
synced 2025-11-20 22:48:16 +00:00
rabbitmq: Add on-close callback atomically in creating the connection.
Adding it afterward is inherently racy, and upstream's API is quite
reasonable for avoiding that -- just like we can pass an on-open
callback up front, we can do the same with the on-close callback.
This is a more thorough version of 4adf2d5c2 from back in 2013-04.
This commit is contained in:
@@ -187,8 +187,8 @@ class TornadoQueueClient(SimpleQueueClient):
|
||||
self.connection = ExceptionFreeTornadoConnection(
|
||||
self._get_parameters(),
|
||||
on_open_callback = self._on_open,
|
||||
on_close_callback = self._on_connection_closed,
|
||||
)
|
||||
self.connection.add_on_close_callback(self._on_connection_closed)
|
||||
|
||||
def _reconnect(self) -> None:
|
||||
self.connection = None
|
||||
|
||||
Reference in New Issue
Block a user