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

Jeremy Hylton jeremy at zope.com
Fri Oct 3 16:27:33 EDT 2003


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

Modified Files:
	ClientStorage.py 
Log Message:
Make sure there is a timeout in the synchronous case, too.

Synchronous is what matters for the tests.


=== ZODB3/ZEO/ClientStorage.py 1.110 => 1.111 ===
--- ZODB3/ZEO/ClientStorage.py:1.110	Thu Oct  2 14:17:22 2003
+++ ZODB3/ZEO/ClientStorage.py	Fri Oct  3 16:27:32 2003
@@ -319,6 +319,9 @@
     def _wait(self, timeout=None):
         if timeout is not None:
             deadline = time.time() + timeout
+            log2(BLATHER, "Setting deadline to %f" % deadline)
+        else:
+            deadline = None
         # Wait for a connection to be established.
         self._rpc_mgr.connect(sync=1)
         # When a synchronous connect() call returns, there is
@@ -336,19 +339,22 @@
                     break
                 log2(INFO, "Waiting for cache verification to finish")
         else:
-            self._wait_sync()
+            self._wait_sync(deadline)
 
-    def _wait_sync(self):
+    def _wait_sync(self, deadline=None):
         # If there is no mainloop running, this code needs
         # to call poll() to cause asyncore to handle events.
         while 1:
             if self._ready.isSet():
                 break
+            if deadline and time.time() > deadline:
+                log2(PROBLEM, "Timed out waiting for connection")
+                break
             log2(INFO, "Waiting 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()
+                return self._wait(deadline - time.time())
             else:
                 self._connection.pending(30)
 




More information about the Zope-Checkins mailing list