From 9d9dc037d8accbe0e1aedf973fba3f7ed3153e6d Mon Sep 17 00:00:00 2001 From: grossmj Date: Mon, 15 Jan 2018 14:42:01 +0700 Subject: [PATCH] Refresh CPU/RAM info every 1 second. Ref #2262. --- gns3server/handlers/api/compute/notification_handler.py | 2 +- gns3server/notification_queue.py | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/gns3server/handlers/api/compute/notification_handler.py b/gns3server/handlers/api/compute/notification_handler.py index 1347f70b..3580a286 100644 --- a/gns3server/handlers/api/compute/notification_handler.py +++ b/gns3server/handlers/api/compute/notification_handler.py @@ -48,7 +48,7 @@ class NotificationHandler: with notifications.queue() as queue: while True: try: - notification = yield from queue.get_json(5) + notification = yield from queue.get_json(1) except asyncio.futures.CancelledError: break if ws.closed: diff --git a/gns3server/notification_queue.py b/gns3server/notification_queue.py index c52f8968..88cbaec3 100644 --- a/gns3server/notification_queue.py +++ b/gns3server/notification_queue.py @@ -16,7 +16,6 @@ # along with this program. If not, see . import asyncio -import psutil import json import psutil @@ -33,10 +32,10 @@ class NotificationQueue(asyncio.Queue): @asyncio.coroutine def get(self, timeout): """ - When timeout is expire we send a ping notification with server informations + When timeout is expire we send a ping notification with server information """ - # At first get we return a ping so the client receive immediately data + # At first get we return a ping so the client immediately receives data if self._first: self._first = False return ("ping", self._getPing(), {})