Instantiate lock inside event loop (#24203)

This commit is contained in:
Paulus Schoutsen 2019-05-31 11:26:05 -07:00 committed by GitHub
parent 8fe1a84db2
commit 440e4289e4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -45,7 +45,7 @@ class EntityPlatform:
self._async_unsub_polling = None
# Method to cancel the retry of setup
self._async_cancel_retry_setup = None
self._process_updates = asyncio.Lock()
self._process_updates = None
# Platform is None for the EntityComponent "catch-all" EntityPlatform
# which powers entity_component.add_entities
@ -404,6 +404,8 @@ class EntityPlatform:
This method must be run in the event loop.
"""
if self._process_updates is None:
self._process_updates = asyncio.Lock()
if self._process_updates.locked():
self.logger.warning(
"Updating %s %s took longer than the scheduled update "