1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-12-01 04:38:12 +00:00

Refresh CPU/RAM info every 1 second. Ref #2262.

This commit is contained in:
grossmj 2018-01-15 14:42:01 +07:00
parent ffc7024b64
commit 9d9dc037d8
2 changed files with 3 additions and 4 deletions

View File

@ -48,7 +48,7 @@ class NotificationHandler:
with notifications.queue() as queue: with notifications.queue() as queue:
while True: while True:
try: try:
notification = yield from queue.get_json(5) notification = yield from queue.get_json(1)
except asyncio.futures.CancelledError: except asyncio.futures.CancelledError:
break break
if ws.closed: if ws.closed:

View File

@ -16,7 +16,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
import asyncio import asyncio
import psutil
import json import json
import psutil import psutil
@ -33,10 +32,10 @@ class NotificationQueue(asyncio.Queue):
@asyncio.coroutine @asyncio.coroutine
def get(self, timeout): 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: if self._first:
self._first = False self._first = False
return ("ping", self._getPing(), {}) return ("ping", self._getPing(), {})