Graceful shutdown for modules and locale check for the server.

This commit is contained in:
grossmj committed 2014-04-24 15:59:34 -06:00
1 parent 9be5625c38
commit 7ebd451dda
4 files changed
+52 -6

No files matched your search

+6 -2
View File
@@ -54,6 +54,7 @@ class IModule(multiprocessing.Process):
self._current_session = None
self._current_destination = None
self._current_call_id = None
self._stopping = False
def _setup(self):
"""
@@ -128,13 +129,16 @@ class IModule(multiprocessing.Process):
except KeyboardInterrupt:
return
log.info("{} module has stopped".format(self.name))
def stop(self):
"""
Stops the event loop.
"""
if self._ioloop:
self._ioloop.stop()
if not self._stopping:
self._stopping = True
self._ioloop.add_callback_from_signal(self._ioloop.stop)
def send_response(self, results):
"""
+2 -2
View File
@@ -442,8 +442,8 @@ class IOUDevice(object):
self._started = True
except OSError as e:
iou_stdout = self.read_iou_stdout()
log.error("could not start IOU: {}\n{}".format(e, iou_stdout))
raise IOUError("could not start IOU: {}\n{}".format(e, iou_stdout))
log.error("could not start IOU {}: {}\n{}".format(self._path, e, iou_stdout))
raise IOUError("could not start IOU {}: {}\n{}".format(self._path, e, iou_stdout))
# start console support
self._start_ioucon()