Skip to content
Snippets Groups Projects
Commit d85096f3 authored by John Chilton's avatar John Chilton
Browse files

Improved heartbeat thread handling in amqp_exchange.

 - Add a join timeout incase this is is where things are hanging.
 - Don't allow heartbeat or sleep exceptions to halt queue consumption - shutdown events need to fire to actually stop this computation.
 - Add more logging to determine if this is a problematic spot.
parent 710ac5f3
No related branches found
No related tags found
No related merge requests found
...@@ -86,9 +86,15 @@ class PulsarExchange(object): ...@@ -86,9 +86,15 @@ class PulsarExchange(object):
except (IOError, socket.error), exc: except (IOError, socket.error), exc:
# In testing, errno is None # In testing, errno is None
log.warning('Got %s, will retry: %s', exc.__class__.__name__, exc) log.warning('Got %s, will retry: %s', exc.__class__.__name__, exc)
if heartbeat_thread: try:
heartbeat_thread.join() if heartbeat_thread:
sleep(DEFAULT_RECONNECT_CONSUMER_WAIT) heartbeat_thread.join(DEFAULT_HEARTBEAT_JOIN_TIMEOUT)
except Exception:
log.exception("Failed to join heartbeat thread, this is bad?")
try:
sleep(DEFAULT_RECONNECT_CONSUMER_WAIT)
except Exception:
log.exception("Interrupted sleep while waiting to reconnect to message queue, may restart unless problems encountered.")
except BaseException: except BaseException:
log.exception("Problem consuming queue, consumer quitting in problematic fashion!") log.exception("Problem consuming queue, consumer quitting in problematic fashion!")
raise raise
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment