From bea53b6eca689bb128a29654def0c3572c2c2e0e Mon Sep 17 00:00:00 2001 From: asmorodskyi Date: Fri, 28 Oct 2022 09:13:07 +0200 Subject: [PATCH] scheduler: fine tune how long job may be late for trigger appointment It was set to 2 minutes when we have single executor and one job interval is 1 hour and another job interval is 13 hours and approximate time to execute job is 5 minutes. Also time was same for both jobs which does not make any sense --- ocw/apps.py | 3 +-- ocw/lib/cleanup.py | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/ocw/apps.py b/ocw/apps.py index 68dc76a0..69b8c334 100644 --- a/ocw/apps.py +++ b/ocw/apps.py @@ -18,8 +18,7 @@ def getScheduler(): } job_defaults = { 'coalesce': False, - 'max_instances': 1, - 'misfire_grace_time': 120, + 'max_instances': 1 } __scheduler = BackgroundScheduler(executors=executors, job_defaults=job_defaults, timezone=utc) return __scheduler diff --git a/ocw/lib/cleanup.py b/ocw/lib/cleanup.py index 67003e4e..de382fc0 100644 --- a/ocw/lib/cleanup.py +++ b/ocw/lib/cleanup.py @@ -44,5 +44,5 @@ def list_clusters(): def init_cron(): - getScheduler().add_job(cleanup_run, trigger='interval', minutes=60, id='cleanup_all') - getScheduler().add_job(list_clusters, trigger='interval', hours=18, id='list_clusters') + getScheduler().add_job(cleanup_run, trigger='interval', minutes=60, id='cleanup_all', misfire_grace_time=1800) + getScheduler().add_job(list_clusters, trigger='interval', hours=18, id='list_clusters', misfire_grace_time=10000)