retry startup
This commit is contained in:
parent
b744a54340
commit
1c92b5d2ea
1 changed files with 14 additions and 8 deletions
|
@ -114,7 +114,7 @@ def update_settings_from_args(args):
|
||||||
|
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def start_server_and_listen(launchui, use_auth, analytics_manager):
|
def start_server_and_listen(launchui, use_auth, analytics_manager, max_tries=5):
|
||||||
"""The primary entry point for launching the daemon.
|
"""The primary entry point for launching the daemon.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
|
@ -124,13 +124,19 @@ def start_server_and_listen(launchui, use_auth, analytics_manager):
|
||||||
"""
|
"""
|
||||||
analytics_manager.send_server_startup()
|
analytics_manager.send_server_startup()
|
||||||
log_support.configure_analytics_handler(analytics_manager)
|
log_support.configure_analytics_handler(analytics_manager)
|
||||||
|
tries = 1
|
||||||
|
while tries < max_tries:
|
||||||
|
log.info('Making attempt %s / %s to startup', tries, max_tries)
|
||||||
try:
|
try:
|
||||||
daemon_server = DaemonServer(analytics_manager)
|
daemon_server = DaemonServer(analytics_manager)
|
||||||
yield daemon_server.start(use_auth, launchui)
|
yield daemon_server.start(use_auth, launchui)
|
||||||
analytics_manager.send_server_startup_success()
|
analytics_manager.send_server_startup_success()
|
||||||
|
break
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.exception('Failed to startup')
|
log.exception('Failed to startup')
|
||||||
analytics_manager.send_server_startup_error(str(e))
|
analytics_manager.send_server_startup_error(str(e))
|
||||||
|
tries += 1
|
||||||
|
else:
|
||||||
reactor.callFromThread(reactor.stop)
|
reactor.callFromThread(reactor.stop)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue