Skip to content

Commit

Permalink
Fixed deadlock
Browse files Browse the repository at this point in the history
  • Loading branch information
albaintor committed Jul 23, 2024
1 parent e92f30b commit 12baff8
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions intg-panasonicbluray/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ def __init__(self, device_config: DeviceInstance, timeout=3, refresh_frequency=6
self._state = States.UNKNOWN
self._event_loop = asyncio.get_event_loop() or asyncio.get_running_loop()
self.events = AsyncIOEventEmitter(self._event_loop)
self._update_lock = Lock()
self._session: ClientSession | None = None
self._variant = PlayerVariant.AUTO
self._media_position = 0
Expand All @@ -135,14 +134,10 @@ async def disconnect(self):

async def start_polling(self):
"""Start polling task."""
if self._update_task is not None:
return
await self._update_lock.acquire()
if self._update_task is not None:
return
_LOGGER.debug("Start polling task for device %s", self.id)
self._update_task = self._event_loop.create_task(self._background_update_task())
self._update_lock.release()

async def stop_polling(self):
"""Stop polling task."""
Expand Down

0 comments on commit 12baff8

Please sign in to comment.