Skip to content

Commit 7312a35

Browse files
committed
feat: Only use one event loop
1 parent c606be7 commit 7312a35

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

pantograph/utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
from pathlib import Path
33
import functools as F
44

5+
DEFAULT_EVENT_LOOP = asyncio.new_event_loop()
6+
57
def get_event_loop():
68
try:
79
return asyncio.get_event_loop()
810
except RuntimeError:
9-
loop = asyncio.new_event_loop()
10-
asyncio.set_event_loop(loop)
11+
asyncio.set_event_loop(DEFAULT_EVENT_LOOP)
1112
return loop
1213

1314
def to_sync(func):

0 commit comments

Comments
 (0)