fix daemon shutdown

This commit is contained in:
Alex Grintsvayg 2017-08-02 17:21:24 -04:00
parent ddcf3a47f8
commit ea9d368d09
3 changed files with 9 additions and 18 deletions

View file

@ -20,6 +20,9 @@ at anytime.
### Fixed
*
*
* Fixed incorrect formatting of "amount" fields
* Fixed handling of SIGINT, SIGTERM.
* Fixed shutdown sequence
### Deprecated
* The API will no longer be served at the /lbryapi path. It will now be at the root.

View file

@ -18,18 +18,8 @@ def test_internet_connection():
return utils.check_connection()
def stop():
conf.initialize_settings()
log_support.configure_console()
try:
LBRYAPIClient.get_client().call('stop')
except Exception:
log.exception('Failed to stop deamon')
else:
log.info("Shutting down lbrynet-daemon from command line")
def start():
"""The primary entry point for launching the daemon."""
conf.initialize_settings()
parser = argparse.ArgumentParser(description="Launch lbrynet-daemon")
@ -107,10 +97,9 @@ def start_server_and_listen(use_auth, analytics_manager):
yield daemon_server.start(use_auth)
analytics_manager.send_server_startup_success()
except Exception as e:
log.exception('Failed to startup')
yield daemon_server.stop()
log.exception('Failed to start')
analytics_manager.send_server_startup_error(str(e))
reactor.fireSystemEvent("shutdown")
daemon_server.stop()
if __name__ == "__main__":

View file

@ -54,10 +54,9 @@ class DaemonServer(object):
@defer.inlineCallbacks
def stop(self):
if self._api is not None:
yield self._api._shutdown()
if self.server_port is not None:
yield self.server_port.stopListening()
if reactor.running:
log.info("Stopping the reactor")
reactor.fireSystemEvent("shutdown")
def get_site_base(use_auth, root):