[Zope3-checkins] CVS: Zope3/src/zodb/zeo - client.py:1.4.2.3

Jeremy Hylton jeremy@zope.com
Thu, 13 Feb 2003 12:39:40 -0500


Update of /cvs-repository/Zope3/src/zodb/zeo
In directory cvs.zope.org:/tmp/cvs-serv4282

Modified Files:
      Tag: ZODB3-2-integration-branch
	client.py 
Log Message:
Port new sync() method and bug fix in tpcAbort().


=== Zope3/src/zodb/zeo/client.py 1.4.2.2 => 1.4.2.3 ===
--- Zope3/src/zodb/zeo/client.py:1.4.2.2	Mon Feb 10 17:08:31 2003
+++ Zope3/src/zodb/zeo/client.py	Thu Feb 13 12:39:39 2003
@@ -22,11 +22,6 @@
 ClientDisconnected -- exception raised by ClientStorage
 """
 
-# XXX TO DO
-# get rid of beginVerify, set up _tfile in verify_cache
-# set self._storage = stub later, in endVerify
-# if wait is given, wait until verify is complete
-
 import cPickle
 import os
 import socket
@@ -323,7 +318,13 @@
 
         This is called by the sync method in ZODB.Connection.
         """
-        self._server._update()
+        # If there is no connection, return immediately.  Technically,
+        # there are no pending invalidations so they are all handled.
+        # There doesn't seem to be much benefit to raising an exception.
+        
+        cn = self._connection
+        if cn is not None:
+            cn.pending()
 
     def testConnection(self, conn):
         """Internal: test the given connection.
@@ -492,6 +493,7 @@
         """
         self.logger.error("Disconnected from storage")
         self._connection = None
+        self._ready.clear()
         self._server = disconnected_stub
 
     def getName(self):
@@ -734,14 +736,22 @@
 
     def tpcAbort(self, transaction):
         """Storage API: abort a transaction."""
+        """Storage API: abort a transaction."""
         if transaction is not self._transaction:
             return
         try:
-            self._server.tpcAbort(self._serial)
+            # XXX Are there any transactions that should prevent an
+            # abort from occurring?  It seems wrong to swallow them
+            # all, yet you want to be sure that other abort logic is
+            # executed regardless.
+            try:
+                self._server.tpc_abort(self._serial)
+            except ClientDisconnected:
+                self.logger.info("ClientDisconnected in tpc_abort() ignored")
+        finally:
             self._tbuf.clear()
             self._seriald.clear()
             del self._serials[:]
-        finally:
             self.end_transaction()
 
     def tpcFinish(self, transaction, f=None):