fix memory usage redis
This commit is contained in:
+7
-8
@@ -308,7 +308,7 @@ class WebServer:
|
||||
direction=self._query_text(query, "direction", 24),
|
||||
)
|
||||
except RedisUnavailableError as exc:
|
||||
self._json({"error": f"Redis traffic history unavailable: {exc}"}, status=503)
|
||||
self._json({"error": f"Traffic history unavailable: {exc}"}, status=503)
|
||||
return
|
||||
self._json({"events": events, "history": traffic_history.status()})
|
||||
return
|
||||
@@ -322,7 +322,7 @@ class WebServer:
|
||||
payload = traffic_history.throughput_analytics(window)
|
||||
self._json(outer._overlay_current_throughput(payload, window))
|
||||
except RedisUnavailableError as exc:
|
||||
self._json({"error": f"Redis throughput history unavailable: {exc}"}, status=503)
|
||||
self._json({"error": f"Traffic throughput unavailable: {exc}"}, status=503)
|
||||
return
|
||||
if parsed.path == "/api/traffic/analytics":
|
||||
if traffic_history is None:
|
||||
@@ -333,7 +333,7 @@ class WebServer:
|
||||
try:
|
||||
payload = outer._analytics_payload(window)
|
||||
except RedisUnavailableError as exc:
|
||||
self._json({"error": f"Redis analytics unavailable: {exc}"}, status=503)
|
||||
self._json({"error": f"Traffic analytics unavailable: {exc}"}, status=503)
|
||||
return
|
||||
self._json(payload)
|
||||
return
|
||||
@@ -548,12 +548,11 @@ class WebServer:
|
||||
try:
|
||||
count = traffic_history.clear() if traffic_history is not None else 0
|
||||
except RedisUnavailableError as exc:
|
||||
self._json({"error": f"Redis traffic history unavailable: {exc}"}, status=503)
|
||||
self._json({"error": f"Traffic history unavailable: {exc}"}, status=503)
|
||||
return
|
||||
# Remove snapshots from older builds; current traffic snapshots live in Redis.
|
||||
legacy_snapshots = store.clear_traffic_snapshots()
|
||||
self._audit("traffic.clear", details={"events": count, "legacy_snapshots": legacy_snapshots})
|
||||
self._json({"ok": True, "message": f"Cleared {count} Redis traffic events and cached chart snapshots"})
|
||||
snapshots = store.clear_traffic_snapshots()
|
||||
self._audit("traffic.clear", details={"events": count, "snapshots": snapshots})
|
||||
self._json({"ok": True, "message": f"Cleared {count} archived/live traffic events and {snapshots} chart snapshots"})
|
||||
return
|
||||
if parsed.path == "/api/admin/ndr/incidents/status":
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user