Adds timeout mechanism for workers

Workers now share a ctype with the sentinel to indicate if they are currently executing a task.  This timer is incremented each guard loop until the worker resets it after finishing a job or until it reaches the TIMEOUT value and the worker is terminated by the sentinel.
This commit is contained in:
Ilan Steemers
2015-07-01 10:54:36 +02:00
parent 5937f55fc5
commit 4e38925cea
4 changed files with 23 additions and 11 deletions
+3
View File
@@ -32,6 +32,9 @@ class Conf(object):
# Number of tasks each worker can handle before it gets recycled. Useful for releasing memory
RECYCLE = conf.get('recycle', 500)
# Number of seconds to wait for a worker to finish.
TIMEOUT = conf.get('timeout', None)
# The Django Admin label for this app
LABEL = conf.get('label', 'Django Q')