mirror of https://github.com/celery/kombu.git
ConsumerMixin: Connection error logs now include traceback. Closes #480
This commit is contained in:
parent
b6c3f99f66
commit
b4d8d860f1
|
@ -28,6 +28,14 @@ __all__ = ['ConsumerMixin']
|
|||
logger = get_logger(__name__)
|
||||
debug, info, warn, error = logger.debug, logger.info, logger.warn, logger.error
|
||||
|
||||
W_CONN_LOST = """\
|
||||
Connection to broker lost, trying to re-establish connection...\
|
||||
"""
|
||||
|
||||
W_CONN_ERROR = """\
|
||||
Broker connection error, trying again in %s seconds: %r.\
|
||||
"""
|
||||
|
||||
|
||||
class ConsumerMixin(object):
|
||||
"""Convenience mixin for implementing consumer programs.
|
||||
|
@ -153,8 +161,7 @@ class ConsumerMixin(object):
|
|||
message.ack()
|
||||
|
||||
def on_connection_error(self, exc, interval):
|
||||
warn('Broker connection error: %r. '
|
||||
'Trying again in %s seconds.', exc, interval)
|
||||
warn(W_CONN_ERROR, interval, exc, exc_info=1)
|
||||
|
||||
@contextmanager
|
||||
def extra_context(self, connection, channel):
|
||||
|
@ -172,8 +179,7 @@ class ConsumerMixin(object):
|
|||
else:
|
||||
sleep(restart_limit.expected_time(_tokens))
|
||||
except errors:
|
||||
warn('Connection to broker lost. '
|
||||
'Trying to re-establish the connection...')
|
||||
warn(W_CONN_LOST, exc_info=1)
|
||||
|
||||
@contextmanager
|
||||
def consumer_context(self, **kwargs):
|
||||
|
|
Loading…
Reference in New Issue