use running loop if possible
This commit is contained in:
parent
e6fbab30aa
commit
79fb296a6e
1 changed files with 5 additions and 2 deletions
|
@ -219,8 +219,11 @@ class UPnP:
|
||||||
kwargs: dict = None) -> None:
|
kwargs: dict = None) -> None:
|
||||||
kwargs = kwargs or {}
|
kwargs = kwargs or {}
|
||||||
|
|
||||||
loop = asyncio.new_event_loop()
|
try:
|
||||||
asyncio.set_event_loop(loop)
|
asyncio.get_running_loop()
|
||||||
|
except RuntimeError:
|
||||||
|
loop = asyncio.new_event_loop()
|
||||||
|
asyncio.set_event_loop(loop)
|
||||||
|
|
||||||
fut: asyncio.Future = asyncio.Future()
|
fut: asyncio.Future = asyncio.Future()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue