mirror of
https://git.quad4.io/RNS-Things/MeshChatX.git
synced 2026-05-11 13:54:41 +00:00
fix(meshchat, health_monitor): add garbage collection calls to cleanup resources during context teardown and health checks
This commit is contained in:
@@ -850,6 +850,7 @@ class ReticulumMeshChat:
|
||||
if identity_hash in self.contexts:
|
||||
del self.contexts[identity_hash]
|
||||
self.current_context = None
|
||||
gc.collect()
|
||||
|
||||
def _teardown_all_contexts_for_reload(self):
|
||||
# Stop per-identity long-running services before tearing down contexts.
|
||||
@@ -879,6 +880,7 @@ class ReticulumMeshChat:
|
||||
self.contexts.clear()
|
||||
self.current_context = None
|
||||
self.running = False
|
||||
gc.collect()
|
||||
|
||||
async def _send_rns_reload_status(
|
||||
self,
|
||||
|
||||
@@ -12,6 +12,7 @@ from in-memory deques kept by PersistentLogHandler and psutil.
|
||||
|
||||
import asyncio
|
||||
import collections
|
||||
import gc
|
||||
import json
|
||||
import logging
|
||||
import threading
|
||||
@@ -59,6 +60,7 @@ class HealthMonitor:
|
||||
self._check()
|
||||
except Exception as exc:
|
||||
_log.debug("HealthMonitor check error: %s", exc)
|
||||
gc.collect()
|
||||
await asyncio.sleep(self.CHECK_INTERVAL)
|
||||
|
||||
def _check(self):
|
||||
|
||||
Reference in New Issue
Block a user