Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

event_queue: Switch finish_current_handler to early-abort via return.

Alex Vandiver010965823890
diff --git a/zerver/tornado/event_queue.py b/zerver/tornado/event_queue.py
index 4a043653275..6f2f9c7f780 100644
--- a/zerver/tornado/event_queue.py
+++ b/zerver/tornado/event_queue.py
@@ -209,21 +209,21 @@ class ClientDescriptor:
self.finish_current_handler()
def finish_current_handler(self) -> bool:
- if self.current_handler_id is not None:
- try:
- finish_handler(
- self.current_handler_id,
- self.event_queue.id,
- self.event_queue.contents(),
- )
- except Exception:
- logging.exception(
- "Got error finishing handler for queue %s", self.event_queue.id, stack_info=True
- )
- finally:
- self.disconnect_handler()
- return True
- return False
+ if self.current_handler_id is None:
+ return False
+ try:
+ finish_handler(
+ self.current_handler_id,
+ self.event_queue.id,
+ self.event_queue.contents(),
+ )
+ except Exception:
+ logging.exception(
+ "Got error finishing handler for queue %s", self.event_queue.id, stack_info=True
+ )
+ finally:
+ self.disconnect_handler()
+ return True
def accepts_event(self, event: Mapping[str, Any]) -> bool:
if self.event_types is not None: