job_queue: fix resume request

Make sure that the queue is set to ready after resuming,
even if the next job is unable to be loaded.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan 2021-11-26 17:32:01 -05:00
parent d25c3c1d49
commit f09c313c5b
1 changed files with 4 additions and 3 deletions

View File

@ -242,13 +242,14 @@ class JobQueue:
web_request: WebRequest
) -> Dict[str, Any]:
async with self.lock:
if self.queue_state == "paused":
self.queue_state = "ready"
if self.queued_jobs and self.pop_queue_handle is None:
if self.queue_state != "loading":
if self.queued_jobs and await self._check_can_print():
self.queue_state = "loading"
event_loop = self.server.get_event_loop()
self.pop_queue_handle = event_loop.delay_callback(
0.01, self._pop_job)
else:
self.queue_state = "ready"
return {
'queued_jobs': self._job_map_to_list(),
'queue_state': self.queue_state