Skip to content

Commit

Permalink
if status is done or failed, use lrem instead of put_back
Browse files Browse the repository at this point in the history
  • Loading branch information
willgraf committed May 15, 2019
1 parent c8dbddd commit 3f0fb4f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions redis_consumer/consumers.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,10 @@ def consume(self):
hvals.get('preprocess_function'),
hvals.get('postprocess_function'),
0, timeit.default_timer() - start)

if hvals.get('status') in {self.final_status, 'failed'}:
# this key is done. remove the key from the processing queue.
self.redis.lrem(self.processing_queue, 1, redis_hash)
elif hvals.get('status') == 'failed':
# the key failed, remove it from the processing queue
self.redis.lrem(self.processing_queue, 1, redis_hash)
else:
# this key is not done yet.
# remove it from processing and push it back to the work queue.
Expand Down

0 comments on commit 3f0fb4f

Please sign in to comment.