Skip to content

Commit

Permalink
fix shutdown bug
Browse files Browse the repository at this point in the history
Worker exits from the consume loop when shutdown is requested.
When the loop is exited the channel is closed
amqp library calls drain_events method.
There may be received messages but since the channel is closed
we cannot process them.
  • Loading branch information
cenkalti committed Oct 19, 2016
1 parent 7d51fc3 commit 8c36236
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions kuyruk/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ def _cancel_queues(self, ch):

def _process_message(self, message):
"""Processes the message received from the queue."""
if self.shutdown_pending.is_set():
return

try:
description = json.loads(message.body)
except Exception:
Expand Down

0 comments on commit 8c36236

Please sign in to comment.