Skip to content

Commit

Permalink
- stop using the Surrogate class
Browse files Browse the repository at this point in the history
  • Loading branch information
dataflake committed Feb 25, 2020
1 parent af1a412 commit 645d781
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/Shared/DC/ZRDB/THUNK.py
Expand Up @@ -20,7 +20,6 @@
from zope.interface import implementer

from .TM import TM
from .TM import Surrogate


LOG = logging.getLogger('Products.ZSQLMethods')
Expand All @@ -37,7 +36,7 @@ def _register(self):
thunk_lock.acquire()

try:
self.transaction_manager.get().join(Surrogate(self))
self.transaction_manager.get().join(self)
except TransactionFailedError:
LOG.error('Failed to join transaction: ', exc_info=True)
# No need to raise here, the transaction is already
Expand Down
5 changes: 4 additions & 1 deletion src/Shared/DC/ZRDB/TM.py
Expand Up @@ -47,7 +47,7 @@ def _begin(self):
def _register(self):
if not self._registered:
try:
self.transaction_manager.get().join(Surrogate(self))
self.transaction_manager.get().join(self)
except TransactionFailedError:
LOG.error('Failed to join transaction: ', exc_info=True)
# No need to raise here, the transaction is already
Expand Down Expand Up @@ -83,13 +83,16 @@ def tpc_finish(self, *ignored):
finally:
self._registered = 0

__inform_commit__ = tpc_finish

def abort(self, *ignored):
try:
self._abort()
finally:
self._registered = 0

tpc_abort = abort
__inform_abort__ = abort

# Most DA's talking to RDBMS systems do not care about commit order, so
# return a constant. Must be a string according to ITransactionManager.
Expand Down

0 comments on commit 645d781

Please sign in to comment.