From f4a2e552073c620b61665a3a34fe88fedc31311f Mon Sep 17 00:00:00 2001 From: Keith Wall Date: Thu, 16 Oct 2014 10:34:03 +0000 Subject: NO-JIRA: Fix timeout on python messaging.Session.commit and rollback Fix both to take timeout arg and raise Timeout exception if timeout expires. Merged from trunk with command: svn merge -c r1619813 https://svn.apache.org/repos/asf/qpid/trunk/ git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/kwall_030_tmp@1632269 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/python/qpid/messaging/endpoints.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/qpid/python/qpid/messaging/endpoints.py b/qpid/python/qpid/messaging/endpoints.py index 50320b888f..8d0356d093 100644 --- a/qpid/python/qpid/messaging/endpoints.py +++ b/qpid/python/qpid/messaging/endpoints.py @@ -732,13 +732,14 @@ class Session(Endpoint): raise NontransactionalSession() self.committing = True self._wakeup() - self._ecwait(lambda: not self.committing, timeout=timeout) + if not self._ecwait(lambda: not self.committing, timeout=timeout): + raise Timeout("commit timed out") if self.aborted: raise TransactionAborted() assert self.committed @synchronized - def rollback(self): + def rollback(self, timeout=None): """ Rollback outstanding transactional work. This consists of all message sends and receives since the prior commit or rollback. @@ -747,7 +748,8 @@ class Session(Endpoint): raise NontransactionalSession() self.aborting = True self._wakeup() - self._ecwait(lambda: not self.aborting) + if not self._ecwait(lambda: not self.aborting, timeout=timeout): + raise Timeout("rollback timed out") assert self.aborted @synchronized -- cgit v1.2.1