Skip to content

Commit

Permalink
job scheduler: Do not try to sleep if no time left
Browse files Browse the repository at this point in the history
If one iteration one iteration of the job scheduler takes longer than
the 60 seconds interval, the scheduler will do the next cycle
immediately without any sleep in between.

Change-Id: Iad25ab11f685fb0b250c79734f369943e0bc9eec
  • Loading branch information
LarsMichelsen committed Dec 4, 2024
1 parent a778d4e commit cb4cdd0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cmk/gui/job_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ def _run_scheduler(crash_report_callback: Callable[[Exception], str]) -> None:
crash_msg = crash_report_callback(exc)
logger.error("Exception in scheduler (Crash ID: %s)", crash_msg, exc_info=True)

time.sleep(60 - (time.time() - cycle_start))
if (sleep_time := 60 - (time.time() - cycle_start)) > 0:
time.sleep(sleep_time)
_wait_for_job_threads(job_threads)


Expand Down

0 comments on commit cb4cdd0

Please sign in to comment.