mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-08-27 12:30:13 +03:00
Merge pull request #2613 from dalearbo/fix/emit-threadpool-runtime-error
fix: handle RuntimeError in notification_manager emit()
This commit is contained in:
commit
126a4099e6
@ -53,8 +53,13 @@ class NotificationManager:
|
||||
:param kwargs: Add this meta to the notification (project_id for example)
|
||||
"""
|
||||
|
||||
for listener in self._listeners:
|
||||
asyncio.get_running_loop().call_soon_threadsafe(listener.put_nowait, (action, event, kwargs))
|
||||
try:
|
||||
for listener in self._listeners:
|
||||
asyncio.get_running_loop().call_soon_threadsafe(listener.put_nowait, (action, event, kwargs))
|
||||
except RuntimeError:
|
||||
# asyncio.get_running_loop() raises RuntimeError when called from
|
||||
# a threadpool with no active event loop (e.g. disk space warnings)
|
||||
pass
|
||||
|
||||
@staticmethod
|
||||
def reset():
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user