From dcfe5b6650c11252659030fe180d2128b5a82f44 Mon Sep 17 00:00:00 2001 From: blockisec <62061776+blockisec@users.noreply.github.com> Date: Fri, 11 Oct 2024 15:03:18 +0200 Subject: [PATCH] Fix missing ack_id when finishing task (#224) * Update monitor.py * format --------- Co-authored-by: Stan Triepels <1939656+GDay@users.noreply.github.com> --- django_q/monitor.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/django_q/monitor.py b/django_q/monitor.py index 37ea940..b6b0b43 100644 --- a/django_q/monitor.py +++ b/django_q/monitor.py @@ -145,7 +145,11 @@ def save_task(task, broker: Broker): attempt_count=1, ) - if Conf.MAX_ATTEMPTS > 0 and task_obj.attempt_count >= Conf.MAX_ATTEMPTS: + if ( + Conf.MAX_ATTEMPTS > 0 + and task_obj.attempt_count >= Conf.MAX_ATTEMPTS + and task.get("ack_id") + ): broker.acknowledge(task["ack_id"]) except Exception: