Skip to content

Commit

Permalink
Remove task from Redis if NACK-ing with retry=False
Browse files Browse the repository at this point in the history
  • Loading branch information
catileptic committed Jul 8, 2024
1 parent a7ef3aa commit 8f69579
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion servicelayer/taskqueue.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ def mark_done(self, task: Task):
status = self.get_status()
if status["running"] == 0 and status["pending"] == 0:
# remove the dataset from active datasets
self.conn.srem(self.key, self.name)
pipe.srem(self.key, self.name)
# reset finished task count
pipe.delete(self.finished_key)
# delete information about running stages
Expand Down Expand Up @@ -665,6 +665,8 @@ def nack_message(self, task, channel, requeue=True):
if not dataset.is_task_tracked(task):
dataset.add_task(task.task_id, task.operation)
dataset.mark_for_retry(task)
else:
dataset.mark_done(task)
if channel.is_open:
channel.basic_nack(delivery_tag=task.delivery_tag, requeue=requeue)
clear_contextvars()
Expand Down

0 comments on commit 8f69579

Please sign in to comment.