mirror of
https://github.com/django-q2/django-q2.git
synced 2026-10-08 12:58:12 +08:00
+5
-1
@@ -34,6 +34,7 @@ from django_q.conf import Conf, logger, psutil, get_ppid, rollbar
|
||||
from django_q.models import Task, Success, Schedule
|
||||
from django_q.status import Stat, Status
|
||||
from django_q.brokers import get_broker
|
||||
from django_q.signals import pre_execute
|
||||
|
||||
|
||||
class Cluster(object):
|
||||
@@ -373,8 +374,11 @@ def worker(task_queue, result_queue, timer, timeout=Conf.TIMEOUT):
|
||||
# We're still going
|
||||
if not result:
|
||||
db.close_old_connections()
|
||||
timer_value = task['kwargs'].pop('timeout', timeout or 0)
|
||||
# signal execution
|
||||
pre_execute.send(sender="django_q", func=f, task=task)
|
||||
# execute the payload
|
||||
timer.value = task['kwargs'].pop('timeout', timeout or 0) # Busy
|
||||
timer.value = timer_value # Busy
|
||||
try:
|
||||
res = f(*task['args'], **task['kwargs'])
|
||||
result = (res, True)
|
||||
|
||||
Reference in New Issue
Block a user