From f9ca08752eccabaed9e8dc185b6d10ed81ce3cfd Mon Sep 17 00:00:00 2001 From: duhow Date: Tue, 23 Apr 2024 16:04:17 +0200 Subject: [PATCH] fix: check if there are no queued jobs --- src/app.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/app.py b/src/app.py index 781561e..d170aa0 100644 --- a/src/app.py +++ b/src/app.py @@ -128,10 +128,14 @@ def process_workflow_job(): def monitor_queued_jobs(): """Return the job that has been queued and not starting for long time.""" app.logger.debug("Starting monitor_queued_jobs") + if not jobs: return queued_jobs = [job for job in jobs.values() if job.action == "queued"] + if not queued_jobs: + return + job = min(queued_jobs, key=lambda x: x.time_start) delay = (datetime.now() - job.time_start).seconds