fix(queue): pause & resume

This must not have been tested after the processors were unified. Needed to shift the logic around so the resume event is handled correctly. Clear and easy fix.
This commit is contained in:
psychedelicious 2024-03-30 17:14:57 +11:00 committed by Kent Keirsey
parent 5be69f191d
commit 9a1b35fa37

View File

@ -121,9 +121,15 @@ class DefaultSessionProcessor(SessionProcessorBase):
poll_now_event.clear()
# Middle processor try block; any unhandled exception is a non-fatal processor error
try:
# If we are paused, wait for resume event
if resume_event.is_set():
# Get the next session to process
self._queue_item = self._invoker.services.session_queue.dequeue()
if self._queue_item is not None and resume_event.is_set():
if self._queue_item is None:
# Empty queue, wait for next polling interval or event to try again
continue
self._invoker.services.logger.debug(f"Executing queue item {self._queue_item.item_id}")
cancel_event.clear()