mirror of https://github.com/rq/rq.git
Allow for configurable scheduler fallback period (#1759)
* Allow for configurable scheduler fallback period This adds a parameter to the Scheduler called `fallback_period`, which determines the period before work fallsback to a new scheduler. * Update defaults.py Reduce Scheduler Fallback Period to 120 seconds. * Update scheduler.py Remove fallback period parameter.
This commit is contained in:
parent
9c2d353640
commit
0f5f18bec7
|
@ -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
|
||||
|
|
|
@ -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"""
|
||||
|
|
Loading…
Reference in New Issue