diff --git a/rq/defaults.py b/rq/defaults.py index 93f603e8..2e99a289 100644 --- a/rq/defaults.py +++ b/rq/defaults.py @@ -8,5 +8,6 @@ DEFAULT_JOB_MONITORING_INTERVAL = 30 DEFAULT_RESULT_TTL = 500 DEFAULT_FAILURE_TTL = 31536000 # 1 year in seconds DEFAULT_LOGGING_DATE_FORMAT = '%H:%M:%S' +DEFAULT_SCHEDULER_FALLBACK_PERIOD = 120 DEFAULT_LOGGING_FORMAT = '%(asctime)s %(message)s' CALLBACK_TIMEOUT = 60 diff --git a/rq/scheduler.py b/rq/scheduler.py index 577976c0..4305cdea 100644 --- a/rq/scheduler.py +++ b/rq/scheduler.py @@ -9,7 +9,8 @@ from multiprocessing import Process from redis import SSLConnection, UnixDomainSocketConnection -from .defaults import DEFAULT_LOGGING_DATE_FORMAT, DEFAULT_LOGGING_FORMAT +from .defaults import (DEFAULT_LOGGING_DATE_FORMAT, DEFAULT_LOGGING_FORMAT, + DEFAULT_SCHEDULER_FALLBACK_PERIOD) from .job import Job from .logutils import setup_loghandlers from .queue import Queue @@ -98,7 +99,7 @@ class RQScheduler: return False if not self.lock_acquisition_time: return True - return (datetime.now() - self.lock_acquisition_time).total_seconds() > 600 + return (datetime.now() - self.lock_acquisition_time).total_seconds() > DEFAULT_SCHEDULER_FALLBACK_PERIOD def acquire_locks(self, auto_start=False): """Returns names of queue it successfully acquires lock on"""