ruff: Fix B012 return inside finally blocks.

return inside finally blocks causes exceptions to be silenced.
Although these blocks follow blanket ‘except Exception’ handlers, they
do not seem to have a goal of silencing BaseException and exceptions
thrown by the exception handler, so rewrite them to avoid it.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2022-11-15 21:04:34 -08:00 committed by Tim Abbott
parent c4e5ddd67f
commit 1735b8863e
2 changed files with 11 additions and 11 deletions

View File

@ -339,11 +339,11 @@ class QueueProcessingWorker(ABC):
# especially since the queue might go idle until new events come in. # especially since the queue might go idle until new events come in.
self.update_statistics() self.update_statistics()
self.idle = True self.idle = True
return else:
self.consume_iteration_counter += 1 self.consume_iteration_counter += 1
if ( if (
self.consume_iteration_counter >= self.CONSUME_ITERATIONS_BEFORE_UPDATE_STATS_NUM self.consume_iteration_counter
>= self.CONSUME_ITERATIONS_BEFORE_UPDATE_STATS_NUM
or time.time() - self.last_statistics_update_time or time.time() - self.last_statistics_update_time
>= self.MAX_SECONDS_BEFORE_UPDATE_STATS >= self.MAX_SECONDS_BEFORE_UPDATE_STATS
): ):