Lazy initialise the worker pool (#4110)

* Lazy initialise the worker pool

* Minimize pool initialization in core tests

* Fix tests on Python 3.4

* Remove passing in thread count to mock HASS

* Tests: Allow pool by default for threaded, disable for async

* Remove JobPriority for thread pool

* Fix wrong block_till_done

* EmulatedHue: Remove unused test code

* Zigbee: do not touch hass.pool

* Init loop in add_job

* Fix core test

* Fix random sensor test
This commit is contained in:
Paulus Schoutsen 2016-10-31 08:47:29 -07:00 committed by GitHub
parent a1e910f1cf
commit 7f699b4261
26 changed files with 140 additions and 185 deletions

View file

@ -12,7 +12,6 @@ import voluptuous as vol
from homeassistant.components import zigbee
from homeassistant.components.zigbee import PLATFORM_SCHEMA
from homeassistant.const import TEMP_CELSIUS
from homeassistant.core import JobPriority
from homeassistant.helpers.entity import Entity
_LOGGER = logging.getLogger(__name__)
@ -56,8 +55,7 @@ class ZigBeeTemperatureSensor(Entity):
self._config = config
self._temp = None
# Get initial state
hass.pool.add_job(
JobPriority.EVENT_STATE, (self.update_ha_state, True))
hass.add_job(self.update_ha_state, True)
@property
def name(self):