in uamqp/client.py [0:0]
def _client_run(self):
"""MessageReceiver Link is now open - start receiving messages.
Will return True if operation successful and client can remain open for
further work.
:rtype: bool
"""
self.message_handler.work()
self._connection.work()
now = self._counter.get_current_ms()
if self._last_activity_timestamp and not self._was_message_received:
# If no messages are coming through, back off a little to keep CPU use low.
time.sleep(0.05)
if self._timeout > 0:
timespan = now - self._last_activity_timestamp
if timespan >= self._timeout:
self._timeout_reached = True
if self._shutdown_after_timeout:
_logger.info("Timeout reached, closing receiver.")
self._shutdown = True
else:
self._last_activity_timestamp = None # To reuse the receiver, reset the timestamp
_logger.info("Timeout reached, keeping receiver open.")
else:
self._last_activity_timestamp = now
self._was_message_received = False
return True