def _is_live(self, action): # pylint: disable=no-member if self.settled: raise MessageAlreadySettled(action) try: if self.expired: raise MessageLockExpired(inner_exception=self.auto_renew_error) except TypeError: pass if hasattr(self._receiver, 'expired') and self._receiver.expired: raise SessionLockExpired(inner_exception=self._receiver.auto_renew_error)
def _handle_exception(self, exception): if isinstance(exception, errors.LinkDetach ) and exception.condition == SESSION_LOCK_LOST: error = SessionLockExpired( "Connection detached - lock on Session {} lost.".format( self.session_id)) self.close(exception=error) raise error elif isinstance(exception, errors.LinkDetach ) and exception.condition == SESSION_LOCK_TIMEOUT: error = NoActiveSession( "Queue has no active session to receive from.") self.close(exception=error) raise error return super(SessionReceiver, self)._handle_exception(exception)
def _can_run(self): super(SessionReceiver, self)._can_run() if self.expired: raise SessionLockExpired(inner_exception=self.auto_renew_error)