Remove ThreadPool with async executor (#4154)
* Remove ThreadPool with async executor * Fix zigbee * update unittest * fix remote api * add pending task to remote * fix lint * remove unused import * remove old stuff for lazy tests * fix bug and add a exception handler to executor * change executor handling * change to wait from gather * fix unittest
This commit is contained in:
parent
b67f1fed52
commit
ece58ce78f
10 changed files with 37 additions and 346 deletions
|
@ -16,6 +16,7 @@ import logging
|
|||
import time
|
||||
import threading
|
||||
import urllib.parse
|
||||
import weakref
|
||||
|
||||
from typing import Optional
|
||||
|
||||
|
@ -127,7 +128,7 @@ class HomeAssistant(ha.HomeAssistant):
|
|||
self.executor = ThreadPoolExecutor(max_workers=5)
|
||||
self.loop.set_default_executor(self.executor)
|
||||
self.loop.set_exception_handler(self._async_exception_handler)
|
||||
self.pool = ha.create_worker_pool()
|
||||
self._pending_tasks = weakref.WeakSet()
|
||||
|
||||
self.bus = EventBus(remote_api, self)
|
||||
self.services = ha.ServiceRegistry(self.bus, self.add_job, self.loop)
|
||||
|
@ -176,8 +177,6 @@ class HomeAssistant(ha.HomeAssistant):
|
|||
self.bus.fire(ha.EVENT_HOMEASSISTANT_STOP,
|
||||
origin=ha.EventOrigin.remote)
|
||||
|
||||
self.pool.stop()
|
||||
|
||||
# Disconnect master event forwarding
|
||||
disconnect_remote_events(self.remote_api, self.config.api)
|
||||
self.state = ha.CoreState.not_running
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue