after_reply_message_received in finally block

This commit is contained in:
Ask Solem 2012-06-24 12:00:53 +01:00
parent b397281f0e
commit ecd368c9c1
1 changed files with 9 additions and 7 deletions

View File

@ -168,13 +168,15 @@ def isend_reply(pool, exchange, req, msg, props, **retry_policy):
def collect_replies(conn, channel, queue, *args, **kwargs):
no_ack = kwargs.setdefault('no_ack', True)
received = False
for body, message in itermessages(conn, channel, queue, *args, **kwargs):
if not no_ack:
message.ack()
received = True
yield body
if received:
channel.after_reply_message_received(queue.name)
try:
for body, message in itermessages(conn, channel, queue, *args, **kwargs):
if not no_ack:
message.ack()
received = True
yield body
finally:
if received:
channel.after_reply_message_received(queue.name)
def _ensure_errback(exc, interval):