Skip to content

Commit

Permalink
Rename shutdown() method to signal_stop() as this is what it really does
Browse files Browse the repository at this point in the history
  • Loading branch information
dnaeon committed Sep 3, 2014
1 parent 937e32b commit f06262f
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/vpoller/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def __init__(self, config_file, num_workers=0):
self.mgmt_socket = None
self.mgmt_methods = {
'status': self.status,
'shutdown': self.shutdown,
'shutdown': self.signal_stop,
}
self.config_defaults = {
'db': '/var/lib/vconnector/vconnector.db',
Expand Down Expand Up @@ -96,18 +96,14 @@ def stop(self):
self.close_sockets()
self.stop_workers()

def shutdown(self):
def signal_stop(self):
"""
Set the exit flag for shutting down
Usually this method is intended to be called through the management interface
Signal the vPoller Worker Manager that shutdown time has arrived
"""
msg = 'Shutdown time has arrived, stopping vPoller Worker'
logging.info(msg)
self.time_to_die.set()

return { 'success': 0, 'msg': msg }
return { 'success': 0, 'msg': 'Shutdown time has arrived' }

def load_config(self):
"""
Expand Down Expand Up @@ -150,7 +146,7 @@ def stop_workers(self):
logging.info('Stopping vPoller Worker processes')

for worker in self.workers:
worker.stop()
worker.signal_stop()
worker.join()

def create_sockets(self):
Expand Down

0 comments on commit f06262f

Please sign in to comment.