diff options
author | Alan Conway <aconway@apache.org> | 2014-08-22 14:13:05 +0000 |
---|---|---|
committer | Alan Conway <aconway@apache.org> | 2014-08-22 14:13:05 +0000 |
commit | 97dea4aeed4aacd47b3b601473537282d6e9a796 (patch) | |
tree | 619b7ac98d821eae50f7244f74ed9b02cc049571 /python | |
parent | 85c98970c99421d660ee468a321af15262bbb30d (diff) | |
download | qpid-python-97dea4aeed4aacd47b3b601473537282d6e9a796.tar.gz |
NO-JIRA: Fix timeout on python messaging.Session.commit and rollback
Fix both to take timeout arg and raise Timeout exception if timeout expires.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1619813 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'python')
-rw-r--r-- | python/qpid/messaging/endpoints.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/python/qpid/messaging/endpoints.py b/python/qpid/messaging/endpoints.py index 50320b888f..8d0356d093 100644 --- a/python/qpid/messaging/endpoints.py +++ b/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 |