mirror of https://github.com/rq/rq.git
Fix incorrect worker timeout calculation in SimpleWorker.execute_job (#1304)
In our systems, this bug seemed the be the cause of the disappearing workers: worker keys would get a very small TTL in Redis and would eventually expire, thus mysteriously "disappearing" from dashboards.
This commit is contained in:
parent
4e1eb97056
commit
8a0d9f91ff
|
@ -1034,6 +1034,10 @@ class SimpleWorker(Worker):
|
|||
|
||||
def execute_job(self, job, queue):
|
||||
"""Execute job in same thread/process, do not fork()"""
|
||||
# "-1" means that jobs never timeout. In this case, we should _not_ do -1 + 60 = 59. We should just stick to DEFAULT_WORKER_TTL.
|
||||
if job.timeout == -1:
|
||||
timeout = DEFAULT_WORKER_TTL
|
||||
else:
|
||||
timeout = (job.timeout or DEFAULT_WORKER_TTL) + 60
|
||||
return self.perform_job(job, queue, heartbeat_ttl=timeout)
|
||||
|
||||
|
|
Loading…
Reference in New Issue