[Zodb-checkins] SVN: ZODB/trunk/src/ZEO/zrpc/connection.py Removed a needless timeout to a condition wait call. Using timeouts

Jim Fulton jim at zope.com
Wed Mar 28 19:03:52 EDT 2007


Log message for revision 73871:
  Removed a needless timeout to a condition wait call. Using timeouts
  can cause signidficant delays, especially on systems with very
  course-grained sleeps, like most linux systems.  This change makes the
  ZEO tests run about 25% faster on an Ubuntu desktop system.  We
  suspect the production impact to be much greater, at least on some
  systems.
  
  Removed some non-async code, now that we no-longer have a non-async
  mode. (I cowardly left an assert behind to make sure.:)
  

Changed:
  U   ZODB/trunk/src/ZEO/zrpc/connection.py

-=-
Modified: ZODB/trunk/src/ZEO/zrpc/connection.py
===================================================================
--- ZODB/trunk/src/ZEO/zrpc/connection.py	2007-03-28 19:20:19 UTC (rev 73870)
+++ ZODB/trunk/src/ZEO/zrpc/connection.py	2007-03-28 23:03:51 UTC (rev 73871)
@@ -439,6 +439,9 @@
         self.closed = True
         self.__super_close()
         self.close_trigger()
+        self.replies_cond.acquire()
+        self.replies_cond.notifyAll()
+        self.replies_cond.release()
 
     def close_trigger(self):
         # Overridden by ManagedClientConnection.
@@ -733,24 +736,8 @@
                         self.log("wait(%d): reply=%s" %
                                  (msgid, short_repr(reply)), level=TRACE)
                     return reply
-                if self.is_async():
-                    self.replies_cond.wait(10.0)
-                else:
-                    self.replies_cond.release()
-                    try:
-                        try:
-                            if __debug__:
-                                self.log("wait(%d): asyncore.poll(%s)" %
-                                         (msgid, delay), level=TRACE)
-                            asyncore.poll(delay, self._singleton)
-                            if delay < 1.0:
-                                delay += delay
-                        except select.error, err:
-                            self.log("Closing.  asyncore.poll() raised %s."
-                                     % err, level=BLATHER)
-                            self.close()
-                    finally:
-                        self.replies_cond.acquire()
+                assert self.is_async() # XXX we're such cowards
+                self.replies_cond.wait()
         finally:
             self.replies_cond.release()
 



More information about the Zodb-checkins mailing list