mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-06 15:21:13 +02:00
Implement a minimum interval between psutil calls. Fixes #2262
This commit is contained in:
1 parent
17422bc461
commit
3a09bd43dc
3 files changed
+56
-19
No files matched your search
@@ -19,12 +19,12 @@ import aiohttp
|
||||
import asyncio
|
||||
import json
|
||||
import os
|
||||
import psutil
|
||||
import tempfile
|
||||
|
||||
from gns3server.web.route import Route
|
||||
from gns3server.compute.project_manager import ProjectManager
|
||||
from gns3server.compute import MODULES
|
||||
from gns3server.utils.ping_stats import PingStats
|
||||
|
||||
from gns3server.schemas.project import (
|
||||
PROJECT_OBJECT_SCHEMA,
|
||||
@@ -186,11 +186,7 @@ class ProjectHandler:
|
||||
|
||||
:returns: hash
|
||||
"""
|
||||
stats = {}
|
||||
# Non blocking call in order to get cpu usage. First call will return 0
|
||||
stats["cpu_usage_percent"] = psutil.cpu_percent(interval=None)
|
||||
stats["memory_usage_percent"] = psutil.virtual_memory().percent
|
||||
return {"action": "ping", "event": stats}
|
||||
return {"action": "ping", "event": PingStats.get()}
|
||||
|
||||
@Route.get(
|
||||
r"/projects/{project_id}/files",
|
||||
|
||||
Reference in new issue
Block a user