Commit a77ae75b authored by Jeremy Hylton's avatar Jeremy Hylton

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.
parent 5d56a255
......@@ -296,16 +296,15 @@ class ClientStorage:
# 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."""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment