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.

ruff: Fix B012 return inside finally blocks.

Anders Kaseorg1735b8863e23
diff --git a/zerver/tornado/event_queue.py b/zerver/tornado/event_queue.py
index c8f3304834f..fa57b08b630 100644
--- a/zerver/tornado/event_queue.py
+++ b/zerver/tornado/event_queue.py
@@ -208,7 +208,7 @@ class ClientDescriptor:
)
finally:
self.disconnect_handler()
- return True
+ return True
return False
def accepts_event(self, event: Mapping[str, Any]) -> bool:
diff --git a/zerver/worker/queue_processors.py b/zerver/worker/queue_processors.py
index 48d278102c0..b474e4f1f37 100644
--- a/zerver/worker/queue_processors.py
+++ b/zerver/worker/queue_processors.py
@@ -339,16 +339,16 @@ class QueueProcessingWorker(ABC):
# especially since the queue might go idle until new events come in.
self.update_statistics()
self.idle = True
- return
-
- self.consume_iteration_counter += 1
- if (
- self.consume_iteration_counter >= self.CONSUME_ITERATIONS_BEFORE_UPDATE_STATS_NUM
- or time.time() - self.last_statistics_update_time
- >= self.MAX_SECONDS_BEFORE_UPDATE_STATS
- ):
- self.consume_iteration_counter = 0
- self.update_statistics()
+ else:
+ self.consume_iteration_counter += 1
+ if (
+ self.consume_iteration_counter
+ >= self.CONSUME_ITERATIONS_BEFORE_UPDATE_STATS_NUM
+ or time.time() - self.last_statistics_update_time
+ >= self.MAX_SECONDS_BEFORE_UPDATE_STATS
+ ):
+ self.consume_iteration_counter = 0
+ self.update_statistics()
def consume_single_event(self, event: Dict[str, Any]) -> None:
consume_func = lambda events: self.consume(events[0])