Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreamsorcerer authored Dec 29, 2024
1 parent efeb14d commit 3181edb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions bluetooth_devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ async def connect_sockets(self) -> None:
else:
self.device_registry.connected_devices.append(self)
print("Connected sockets for ",self.object_path)
self.tasks.add(asyncio.run_coroutine_threadsafe(self.loop_of_fun(True), loop=self.loop))
self.tasks.add(asyncio.run_coroutine_threadsafe(self.loop_of_fun(False), loop=self.loop))
self._tasks.add(asyncio.run_coroutine_threadsafe(self.loop_of_fun(True), loop=self.loop))
self._tasks.add(asyncio.run_coroutine_threadsafe(self.loop_of_fun(False), loop=self.loop))
except Exception as err:
print("Error while connecting sockets for ",self.object_path,". Will retry in a sec", err)
try:
Expand All @@ -90,7 +90,7 @@ async def connect_sockets(self) -> None:
asyncio.run_coroutine_threadsafe(self.connect_sockets(), loop=self.loop)

def disconnect_sockets(self) -> None:
for t in self.tasks:
for t in self._tasks:
t.cancel()
with suppress(asyncio.CancelledError):
await t
Expand Down

0 comments on commit 3181edb

Please sign in to comment.