mirror of
https://github.com/django-q2/django-q2.git
synced 2026-10-07 23:28:11 +08:00
add attempt_count to task
This commit is contained in:
@@ -478,7 +478,12 @@ def save_task(task, broker: Broker):
|
||||
existing_task.stopped = task["stopped"]
|
||||
existing_task.result = task["result"]
|
||||
existing_task.success = task["success"]
|
||||
existing_task.attempt_count = existing_task.attempt_count + 1
|
||||
existing_task.save()
|
||||
|
||||
if 0 < Conf.ATTEMPT_COUNT == existing_task.attempt_count:
|
||||
broker.acknowledge(task['ack_id'])
|
||||
|
||||
else:
|
||||
Task.objects.create(
|
||||
id=task["id"],
|
||||
|
||||
Reference in New Issue
Block a user