[Zope-Checkins] CVS: ZODB3/ZEO - ClientStorage.py:1.92

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


Update of /cvs-repository/ZODB3/ZEO
In directory cvs.zope.org:/tmp/cvs-serv24100

Modified Files:
	ClientStorage.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.


=== ZODB3/ZEO/ClientStorage.py 1.91 => 1.92 ===
--- ZODB3/ZEO/ClientStorage.py:1.91	Wed Apr  9 18:31:51 2003
+++ ZODB3/ZEO/ClientStorage.py	Wed Apr  9 18:43:52 2003
@@ -296,16 +296,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
+                log2(INFO, "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
-                log2(INFO, "Wait for cache verification to finish")
+                    self._connection.pending(30)
 
     def close(self):
         """Storage API: finalize the storage, releasing external resources."""