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

Jeremy Hylton jeremy@zope.com
Wed, 9 Apr 2003 18:44:16 -0400


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

Modified Files:
	client.py 
Log Message:
Speed up connection establishment.

Don't know what happened, but the tests started running very slowly
with Python2.3.  Fixed by checking _ready at the start of the loop in
_wait() instead of at the bottom.  Most of the time _ready is set by
the time we start, and no more I/O is going to occur until the client
connects; as a result, the tests always sat in pending() until it
timed out at 30 seconds.


=== Zope3/src/zodb/zeo/client.py 1.8 => 1.9 ===
--- Zope3/src/zodb/zeo/client.py:1.8	Thu Mar 13 17:11:35 2003
+++ Zope3/src/zodb/zeo/client.py	Wed Apr  9 18:44:16 2003
@@ -280,16 +280,15 @@
             # If there is no mainloop running, this code needs
             # to call poll() to cause asyncore to handle events.
             while 1:
-                cn = self._connection
-                if cn is None:
+                if self._ready.isSet():
+                    break
+                self.logger.warn("Wait for cache verification to finish")
+                if self._connection is None:
                     # If the connection was closed while we were
                     # waiting for it to become ready, start over.
                     return self._wait()
                 else:
-                    cn.pending(30)
-                if self._ready.isSet():
-                    break
-                self.logger.warn("Wait for cache verification to finish")
+                    self._connection.pending(30)
 
     def close(self):
         """Storage API: finalize the storage, releasing external resources."""