Skip to content

Commit

Permalink
Ensure we hold strong references to tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco committed Feb 13, 2023
1 parent 35276b6 commit 380f0b0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions aioesphomeapi/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ def __init__(
self._ping_stop_event = asyncio.Event()

self._connect_task: Optional[asyncio.Task[None]] = None
self._keep_alive_task: Optional[asyncio.Task[None]] = None
self._fatal_exception: Optional[Exception] = None
self._expected_disconnect = False

Expand Down
1 change: 1 addition & 0 deletions aioesphomeapi/reconnect_logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ def __init__(
self._wait_task_lock = asyncio.Lock()
# Event for tracking when logic should stop
self._stop_event = asyncio.Event()
self._stop_task: Optional[asyncio.Task[None]] = None

@property
def _is_stopped(self) -> bool:
Expand Down

0 comments on commit 380f0b0

Please sign in to comment.