Skip to content

Commit

Permalink
Execute redis commands at the end of mark_task_for_retry
Browse files Browse the repository at this point in the history
  • Loading branch information
catileptic committed Sep 30, 2024
1 parent 8f744cd commit f44c3c4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions servicelayer/taskqueue.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,18 +354,22 @@ def mark_for_retry(self, task):
pipe.srem(self.pending_key, task_id)
pipe.srem(self.running_key, task_id)

pipe.srem(make_key(PREFIX, "qds", self.name, stage, "pending"), task_id)
pipe.srem(make_key(PREFIX, "qds", self.name, stage, "running"), task_id)
pipe.srem(make_key(PREFIX, "qds", self.name, stage), task_id)

# TODO - remove when there are no wrong tasks left
stage_key = self.get_stage_key(task.operation)
pipe.srem(make_key(stage_key, "pending"), task.task_id)
pipe.srem(make_key(stage_key, "running"), task.task_id)

# delete the retry key for the task
pipe.delete(task.retry_key)

pipe.set(self.last_update_key, pack_now())

pipe.execute()

def is_done(self):
status = self.get_status()
return status["pending"] == 0 and status["running"] == 0
Expand Down

0 comments on commit f44c3c4

Please sign in to comment.