Skip to content

Commit

Permalink
fix: call get_running_loop instead of get_event_loop (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco authored Jan 24, 2025
1 parent 492e0e7 commit e424fe1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/aioharmony/harmonyapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def __init__(
loop: asyncio.AbstractEventLoop = None,
) -> None:
_LOGGER.debug("%s: Initialize", ip_address)
loop = loop if loop else asyncio.get_event_loop()
loop = loop if loop else asyncio.get_running_loop()
self._harmony_client = HarmonyClient(
ip_address=ip_address, protocol=protocol, callbacks=callbacks, loop=loop
)
Expand Down
2 changes: 1 addition & 1 deletion src/aioharmony/harmonyclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def __init__(
if callbacks is not None
else ClientCallbackType(None, None, None, None, None)
)
self._loop = loop if loop else asyncio.get_event_loop()
self._loop = loop if loop else asyncio.get_running_loop()

self._hub_config = ClientConfigType({}, {}, {}, {}, None, [], [])
self._current_activity_id = None
Expand Down
4 changes: 2 additions & 2 deletions src/aioharmony/hubconnector_xmpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ async def hub_connect(self, is_reconnect: bool = False) -> bool:
else:
log_level = 40

loop = asyncio.get_event_loop()
loop = asyncio.get_running_loop()
connected = loop.create_future()

def connection_success(_):
Expand Down Expand Up @@ -252,7 +252,7 @@ async def hub_disconnect(self) -> None:
# reconnect.
self._connected = False

loop = asyncio.get_event_loop()
loop = asyncio.get_running_loop()
disconnected = loop.create_future()

def disconnect_result(_):
Expand Down

0 comments on commit e424fe1

Please sign in to comment.