fixed shutdown messages

This commit is contained in:
Alex Grintsvayg 2017-08-02 15:48:07 -04:00
parent f916a4a82d
commit 02d4444780
9 changed files with 15 additions and 14 deletions

View file

@ -233,7 +233,7 @@ class Api(object):
def track(self, event): def track(self, event):
"""Send a single tracking event""" """Send a single tracking event"""
if not self._enabled: if not self._enabled:
return defer.succeed('analytics disabled') return defer.succeed('Analytics disabled')
def _log_error(failure, event): def _log_error(failure, event):
log.warning('Failed to send track event. %s (%s)', failure.getTraceback(), str(event)) log.warning('Failed to send track event. %s (%s)', failure.getTraceback(), str(event))

View file

@ -27,12 +27,12 @@ class BlobAvailabilityTracker(object):
self._check_mine = LoopingCall(self._update_mine) self._check_mine = LoopingCall(self._update_mine)
def start(self): def start(self):
log.info("Starting %s", self) log.info("Starting blob availability tracker.")
self._check_popular.start(600) self._check_popular.start(600)
self._check_mine.start(600) self._check_mine.start(600)
def stop(self): def stop(self):
log.info("Stopping %s", self) log.info("Stopping blob availability tracker.")
if self._check_popular.running: if self._check_popular.running:
self._check_popular.stop() self._check_popular.stop()
if self._check_mine.running: if self._check_mine.running:

View file

@ -28,12 +28,12 @@ class DiskBlobManager(DHTHashSupplier):
@defer.inlineCallbacks @defer.inlineCallbacks
def setup(self): def setup(self):
log.info("Setting up the DiskBlobManager. blob_dir: %s, db_file: %s", str(self.blob_dir), log.info("Starting disk blob manager. blob_dir: %s, db_file: %s", str(self.blob_dir),
str(self.db_file)) str(self.db_file))
yield self._open_db() yield self._open_db()
def stop(self): def stop(self):
log.info("Stopping the DiskBlobManager") log.info("Stopping disk blob manager.")
self.db_conn.close() self.db_conn.close()
return defer.succeed(True) return defer.succeed(True)

View file

@ -69,7 +69,7 @@ class RateLimiter(object):
self.protocols = [] self.protocols = []
def start(self): def start(self):
log.info("Starting %s", self) log.info("Starting rate limiter.")
self.tick_call = task.LoopingCall(self.tick) self.tick_call = task.LoopingCall(self.tick)
self.tick_call.start(self.tick_interval) self.tick_call.start(self.tick_interval)
@ -80,7 +80,7 @@ class RateLimiter(object):
self.unthrottle_ul() self.unthrottle_ul()
def stop(self): def stop(self):
log.info("Stopping %s", self) log.info("Stopping rate limiter.")
if self.tick_call is not None: if self.tick_call is not None:
self.tick_call.stop() self.tick_call.stop()
self.tick_call = None self.tick_call = None

View file

@ -140,7 +140,7 @@ class Session(object):
def setup(self): def setup(self):
"""Create the blob directory and database if necessary, start all desired services""" """Create the blob directory and database if necessary, start all desired services"""
log.debug("Setting up the lbry session") log.debug("Starting session.")
if self.lbryid is None: if self.lbryid is None:
self.lbryid = generate_id() self.lbryid = generate_id()
@ -169,7 +169,7 @@ class Session(object):
def shut_down(self): def shut_down(self):
"""Stop all services""" """Stop all services"""
log.info('Shutting down %s', self) log.info('Stopping session.')
ds = [] ds = []
if self.blob_tracker is not None: if self.blob_tracker is not None:
ds.append(defer.maybeDeferred(self.blob_tracker.stop)) ds.append(defer.maybeDeferred(self.blob_tracker.stop))
@ -320,7 +320,7 @@ class Session(object):
return dl return dl
def _unset_upnp(self): def _unset_upnp(self):
log.info("Unsetting upnp for %s", self) log.info("Unsetting upnp for session")
def threaded_unset_upnp(): def threaded_unset_upnp():
u = miniupnpc.UPnP() u = miniupnpc.UPnP()

View file

@ -448,6 +448,7 @@ class Wallet(object):
self._batch_count = 20 self._batch_count = 20
def start(self): def start(self):
log.info("Starting wallet.")
def start_manage(): def start_manage():
self.stopped = False self.stopped = False
self.manage() self.manage()
@ -472,7 +473,7 @@ class Wallet(object):
log.error("An error occurred stopping the wallet: %s", err.getTraceback()) log.error("An error occurred stopping the wallet: %s", err.getTraceback())
def stop(self): def stop(self):
log.info("Stopping %s", self) log.info("Stopping wallet.")
self.stopped = True self.stopped = True
# If self.next_manage_call is None, then manage is currently running or else # If self.next_manage_call is None, then manage is currently running or else
# start has not been called, so set stopped and do nothing else. # start has not been called, so set stopped and do nothing else.

View file

@ -25,7 +25,7 @@ class DHTPeerFinder(object):
self.next_manage_call = reactor.callLater(60, self.run_manage_loop) self.next_manage_call = reactor.callLater(60, self.run_manage_loop)
def stop(self): def stop(self):
log.info("Stopping %s", self) log.info("Stopping DHT peer finder.")
if self.next_manage_call is not None and self.next_manage_call.active(): if self.next_manage_call is not None and self.next_manage_call.active():
self.next_manage_call.cancel() self.next_manage_call.cancel()
self.next_manage_call = None self.next_manage_call = None

View file

@ -28,7 +28,7 @@ class DHTHashAnnouncer(object):
self.next_manage_call = utils.call_later(self.ANNOUNCE_CHECK_INTERVAL, self.run_manage_loop) self.next_manage_call = utils.call_later(self.ANNOUNCE_CHECK_INTERVAL, self.run_manage_loop)
def stop(self): def stop(self):
log.info("Stopping %s", self) log.info("Stopping DHT hash announcer.")
if self.next_manage_call is not None: if self.next_manage_call is not None:
self.next_manage_call.cancel() self.next_manage_call.cancel()
self.next_manage_call = None self.next_manage_call = None

View file

@ -346,7 +346,7 @@ class Daemon(AuthJSONRPCServer):
try: try:
if self.lbry_server_port is not None: if self.lbry_server_port is not None:
self.lbry_server_port, old_port = None, self.lbry_server_port self.lbry_server_port, old_port = None, self.lbry_server_port
log.info('Stop listening to %s', old_port) log.info('Stop listening on port %s', old_port.port)
return defer.maybeDeferred(old_port.stopListening) return defer.maybeDeferred(old_port.stopListening)
else: else:
return defer.succeed(True) return defer.succeed(True)