Gracefully exit with async logger (#4965)

* Gracefully exit with async logger

* Lint
This commit is contained in:
Paulus Schoutsen 2016-12-18 00:14:59 -08:00 committed by GitHub
parent a76684f203
commit 01e6bd2c92
2 changed files with 27 additions and 3 deletions

View file

@ -298,9 +298,8 @@ class HomeAssistant(object):
# cleanup async layer from python logging
if self.data.get(DATA_ASYNCHANDLER):
handler = self.data.pop(DATA_ASYNCHANDLER)
logger = logging.getLogger('')
handler.close()
logger.removeHandler(handler)
logging.getLogger('').removeHandler(handler)
yield from handler.async_close(blocking=True)
self.loop.stop()