mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-10-27 10:42:28 +02: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)
|
:param kwargs: Add this meta to the notification (project_id for example)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
for listener in self._listeners:
|
try:
|
||||||
asyncio.get_running_loop().call_soon_threadsafe(listener.put_nowait, (action, event, kwargs))
|
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
|
@staticmethod
|
||||||
def reset():
|
def reset():
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user