service: add an on_shutdown() callback.

pull/209/head
David Wilson 7 years ago
parent 4c5e13bf87
commit 509ef14121

@ -143,6 +143,11 @@ class Service(object):
self.__class__.__name__,
)
def on_shutdown(self):
"""
Called by Pool.shutdown() once the last worker thread has exitted.
"""
def dispatch(self, args, msg):
raise NotImplementedError()
@ -307,6 +312,8 @@ class Pool(object):
self._select.close()
for th in self._threads:
th.join()
for service in self.services:
service.on_shutdown()
def _worker_run(self):
while True:

Loading…
Cancel
Save