Commit aeccfc0f authored by Chong Gu's avatar Chong Gu Committed by Commit Bot

[Fuchsia] Make Fuchsia device connection retry for a full minute.

Remove retry attempt limit, instead keep retrying to connect to device for a minute.
Fuchsia bug: https://bugs.fuchsia.dev/p/fuchsia/issues/detail?id=45090

Change-Id: I0c424fa4d63ffa457c50487261ad37ab97092d3c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2033909
Commit-Queue: Chong Gu <chonggu@google.com>
Reviewed-by: default avatarKevin Marshall <kmarshall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#737553}
parent 05e112bc
...@@ -16,8 +16,8 @@ import time ...@@ -16,8 +16,8 @@ import time
_SHUTDOWN_CMD = ['dm', 'poweroff'] _SHUTDOWN_CMD = ['dm', 'poweroff']
_ATTACH_MAX_RETRIES = 10
_ATTACH_RETRY_INTERVAL = 1 _ATTACH_RETRY_INTERVAL = 1
_ATTACH_RETRY_SECONDS = 60
# Amount of time to wait for Amber to complete package installation, as a # Amount of time to wait for Amber to complete package installation, as a
# mitigation against hangs due to amber/network-related failures. # mitigation against hangs due to amber/network-related failures.
...@@ -206,11 +206,12 @@ class Target(object): ...@@ -206,11 +206,12 @@ class Target(object):
def _AssertIsStarted(self): def _AssertIsStarted(self):
assert self.IsStarted() assert self.IsStarted()
def _WaitUntilReady(self, retries=_ATTACH_MAX_RETRIES): def _WaitUntilReady(self):
logging.info('Connecting to Fuchsia using SSH.') logging.info('Connecting to Fuchsia using SSH.')
for retry in xrange(retries + 1): host, port = self._GetEndpoint()
host, port = self._GetEndpoint() end_time = time.time() + _ATTACH_RETRY_SECONDS
while time.time() < end_time:
runner = remote_cmd.CommandRunner(self._GetSshConfigPath(), host, port) runner = remote_cmd.CommandRunner(self._GetSshConfigPath(), host, port)
if runner.RunCommand(['true'], True) == 0: if runner.RunCommand(['true'], True) == 0:
logging.info('Connected!') logging.info('Connected!')
...@@ -262,4 +263,3 @@ class Target(object): ...@@ -262,4 +263,3 @@ class Target(object):
timeout_secs=_INSTALL_TIMEOUT_SECS) timeout_secs=_INSTALL_TIMEOUT_SECS)
if return_code != 0: if return_code != 0:
raise Exception('Error while installing %s.' % install_package_name) raise Exception('Error while installing %s.' % install_package_name)
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