diff --git a/zerver/tornado/event_queue.py b/zerver/tornado/event_queue.py index c8f3304834..fa57b08b63 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 48d278102c..b474e4f1f3 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])