From 201ebab8198287436db5d1f912c577e3473fa6e9 Mon Sep 17 00:00:00 2001
From: John Chilton <jmchilton@gmail.com>
Date: Mon, 16 Mar 2015 20:56:17 -0400
Subject: [PATCH] Improve client queue handling at shutdown.

 - Don't ack requeued messages (missing return seems like it was a bug).
 - More logging around this event.
---
 pulsar/client/manager.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/pulsar/client/manager.py b/pulsar/client/manager.py
index 120a6531..ce25c264 100644
--- a/pulsar/client/manager.py
+++ b/pulsar/client/manager.py
@@ -96,7 +96,13 @@ class MessageQueueClientManager(object):
 
             def callback_wrapper(body, message):
                 if not self.active:
-                    message.requeue()
+                    log.debug("Obtained update message for inactive client manager, attempting requeue.")
+                    try:
+                        message.requeue()
+                        log.debug("Requeue succeeded, will likely be handled next time consumer is enabled.")
+                    except Exception:
+                        log.debug("Requeue failed, message may be lost?")
+                    return
 
                 try:
                     if "job_id" in body:
-- 
GitLab