Skip to content

Commit ee122dc

Browse files
committed
Fix changed behavior of async loop in stresstest
1 parent 6c0910f commit ee122dc

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/argus/dev/utils.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ def __init__(self, url: str, token: str, timeout: int, worker_count: int):
3333
self.token = token
3434
self.timeout = timeout
3535
self.worker_count = worker_count
36-
self._loop = asyncio.get_event_loop()
36+
try:
37+
self._loop = asyncio.get_running_loop()
38+
except RuntimeError:
39+
self._loop = asyncio.new_event_loop()
3740

3841
def _get_incident_data(self) -> dict[str, Any]:
3942
return {

0 commit comments

Comments
 (0)