From 45471fc865f1247ededbffdaced8f777955fd01c Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Wed, 31 Aug 2016 11:02:04 +0200 Subject: [PATCH] Make sure to drain notification feed Ref https://github.com/GNS3/gns3-gui/issues/1447 --- gns3server/handlers/api/controller/project_handler.py | 1 + gns3server/notification_queue.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/gns3server/handlers/api/controller/project_handler.py b/gns3server/handlers/api/controller/project_handler.py index 31c5e3c2..4c144c8e 100644 --- a/gns3server/handlers/api/controller/project_handler.py +++ b/gns3server/handlers/api/controller/project_handler.py @@ -224,6 +224,7 @@ class ProjectHandler: response.write(("{}\n".format(msg)).encode("utf-8")) except asyncio.futures.CancelledError as e: break + yield from response.drain() if project.auto_close: # To avoid trouble with client connecting disconnecting we sleep few seconds before checking diff --git a/gns3server/notification_queue.py b/gns3server/notification_queue.py index 1575dcc3..c52f8968 100644 --- a/gns3server/notification_queue.py +++ b/gns3server/notification_queue.py @@ -52,7 +52,7 @@ class NotificationQueue(asyncio.Queue): Return the content of the ping notification """ msg = {} - # Non blocking call in order to get cpu usage. First call will return 0 + # Non blocking call in order to get cpu usage. First call will return 0 msg["cpu_usage_percent"] = psutil.cpu_percent(interval=None) msg["memory_usage_percent"] = psutil.virtual_memory().percent return msg