Rev 6170: Switch the code to not loop. So far, no timeout failures. in http://bazaar.launchpad.net/~jameinel/bzr/drop-idle-connections-824797

John Arbash Meinel john at arbash-meinel.com
Fri Sep 16 13:04:49 UTC 2011


At http://bazaar.launchpad.net/~jameinel/bzr/drop-idle-connections-824797

------------------------------------------------------------
revno: 6170
revision-id: john at arbash-meinel.com-20110916130440-pjfyoi0enlu8y6om
parent: john at arbash-meinel.com-20110915152346-obs66lpefjtb7jqx
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: drop-idle-connections-824797
timestamp: Fri 2011-09-16 15:04:40 +0200
message:
  Switch the code to not loop. So far, no timeout failures.
-------------- next part --------------
=== modified file 'bzrlib/smart/medium.py'
--- a/bzrlib/smart/medium.py	2011-09-15 13:58:23 +0000
+++ b/bzrlib/smart/medium.py	2011-09-16 13:04:40 +0000
@@ -294,11 +294,13 @@
             #    afterwards seems to raise EBADF.
             # I think what happens is select.select is unable to see the
             # status of a file that is closed after it starts 'sleeping'.
-            t_end = time.time() + timeout_seconds
-            poll_timeout = min(timeout_seconds, self._client_poll_timeout)
+            # t_end = time.time() + timeout_seconds
+            # poll_timeout = min(timeout_seconds, self._client_poll_timeout)
+            # rs = []
+            # while not rs and time.time() < t_end:
+            #     rs, _, _ = select.select([fd], [], [], poll_timeout)
             rs = []
-            while not rs and time.time() < t_end:
-                rs, _, _ = select.select([fd], [], [], poll_timeout)
+            rs, _, _ = select.select([fd], [], [], timeout_seconds)
         except (select.error, socket.error) as e:
             err = getattr(e, 'errno', None)
             if err is None:
@@ -338,7 +340,6 @@
         """
         raise NotImplementedError(self._read_bytes)
 
-_real_stderr = sys.stderr
 
 class SmartServerSocketStreamMedium(SmartServerStreamMedium):
 



More information about the bazaar-commits mailing list