diff --git a/homeassistant/util/logging.py b/homeassistant/util/logging.py index 736fee0d1b3..095e906efe1 100644 --- a/homeassistant/util/logging.py +++ b/homeassistant/util/logging.py @@ -55,18 +55,11 @@ class AsyncHandler(object): When blocking=True, will wait till closed. """ - if not self._thread.is_alive(): - return yield from self._queue.put(None) if blocking: - # Python 3.4.4+ - # pylint: disable=no-member - if hasattr(self._queue, 'join'): - yield from self._queue.join() - else: - while not self._queue.empty(): - yield from asyncio.sleep(0, loop=self.loop) + while self._thread.is_alive(): + yield from asyncio.sleep(0, loop=self.loop) def emit(self, record): """Process a record.""" @@ -85,23 +78,15 @@ class AsyncHandler(object): def _process(self): """Process log in a thread.""" - support_join = hasattr(self._queue, 'task_done') - while True: record = run_coroutine_threadsafe( self._queue.get(), self.loop).result() - # pylint: disable=no-member - if record is None: self.handler.close() - if support_join: - self.loop.call_soon_threadsafe(self._queue.task_done) return self.handler.emit(record) - if support_join: - self.loop.call_soon_threadsafe(self._queue.task_done) def createLock(self): """Ignore lock stuff."""