Bug 1028407 - Establish connection to server faster.;r=jgriffin
☠☠ backed out by 5aea4fbbb47d ☠ ☠
authorChris Manchester <cmanchester@mozilla.com>
Thu, 03 Jul 2014 17:03:10 -0700
changeset 211088 cb31d5a52868cc5db479676a216ae056032dedb1
parent 211087 40f99ba7f6169936cccb78fba0df1a9c31638733
child 211089 7d93d799ad09a0454f3a5890359b22f0681b787a
push id11501
push usercbook@mozilla.com
push dateMon, 20 Oct 2014 13:53:11 +0000
treeherderb2g-inbound@d46a0089b8a6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgriffin
bugs1028407
milestone36.0a1
Bug 1028407 - Establish connection to server faster.;r=jgriffin There was a 5 second sleep() in the Marionette client. The history of its value is unclear, but bug comments seem to indicate that Gecko wasn't completely initialized during the observer notification that starts the server. We removed the sleep.
testing/marionette/client/marionette/marionette.py
--- a/testing/marionette/client/marionette/marionette.py
+++ b/testing/marionette/client/marionette/marionette.py
@@ -582,27 +582,30 @@ class Marionette(object):
         except socket.error:
             return False
         finally:
             s.close()
 
     def wait_for_port(self, timeout=60):
         starttime = datetime.datetime.now()
         while datetime.datetime.now() - starttime < datetime.timedelta(seconds=timeout):
+            sock = None
             try:
                 sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
                 sock.connect((self.host, self.port))
                 data = sock.recv(16)
                 sock.close()
                 if ':' in data:
-                    time.sleep(5)
                     return True
             except socket.error:
                 pass
-            time.sleep(1)
+            finally:
+                if sock:
+                    sock.close()
+            time.sleep(.1)
         return False
 
     @do_crash_check
     def _send_message(self, command, response_key="ok", **kwargs):
         if not self.session and command != "newSession":
             raise errors.MarionetteException("Please start a session")
 
         message = {"name": command}