chg: Catch exceptions in the main loop

pull/12/head
Raphaël Vinot 2018-04-03 23:31:54 +02:00
parent 595fa671d7
commit 76ec7ff379
1 changed files with 4 additions and 1 deletions

View File

@ -23,7 +23,10 @@ class AbstractManager(ABC):
while True: while True:
if shutdown_requested(): if shutdown_requested():
break break
self._to_run_forever() try:
self._to_run_forever()
except Exception:
self.logger.exception('Something went terribly wrong in {}.'.format(self.__class__.__name__))
if not long_sleep(sleep_in_sec): if not long_sleep(sleep_in_sec):
break break
self.logger.info('Shutting down {}'.format(self.__class__.__name__)) self.logger.info('Shutting down {}'.format(self.__class__.__name__))