mirror of https://github.com/zulip/zulip.git
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:
parent
e88c2a7ee4
commit
3c4e4c14c9
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue