fail quickly if browser dies at startup

instead of trying to retrieve /json for 600 seconds
This commit is contained in:
Noah Levitt 2018-11-01 15:57:03 -07:00
parent 1073431f76
commit 15610fa990
2 changed files with 17 additions and 10 deletions

View File

@ -219,16 +219,23 @@ class Chrome:
'of %d seconds): %s', json_url, timeout_sec, e)
self._last_warning = time.time()
finally:
e = None
if self.chrome_process:
if time.time() - self._start > timeout_sec:
self.logger.error(
'killing chrome, failed to retrieve %s after % '
'seconds', json_url, time.time() - self._start)
self.stop()
raise Exception(
'killed chrome, failed to retrieve %s after %s '
'seconds' % (json_url, time.time() - self._start))
e = Exception(
'killing chrome, failed to retrieve %s after '
'%s seconds' % (
json_url, time.time() - self._start))
elif self.chrome_process.poll() is not None:
e = Exception(
'chrome process died with status %s' % self.chrome_process.poll())
else:
time.sleep(0.5)
else:
e = Exception('??? self.chrome_process is not set ???')
if e:
self.stop()
raise e
def _read_stderr_stdout(self):
# XXX select doesn't work on windows

View File

@ -32,7 +32,7 @@ def find_package_data(package):
setuptools.setup(
name='brozzler',
version='1.5.dev312',
version='1.5.dev313',
description='Distributed web crawling with browsers',
url='https://github.com/internetarchive/brozzler',
author='Noah Levitt',