Batch API endpoints, reduce frontend polling by ~75%, fix resource leaks
Backend: add batch endpoints for target states, metrics, and device health to replace O(N) individual API calls per poll cycle. Frontend: use batch endpoints in dashboard/targets/profiles tabs, fix Chart.js instance leaks, debounce server event reloads, add i18n active-tab guards, clean up ResizeObserver on pattern editor close, cache uptime timer DOM refs, increase KC auto-refresh to 2s. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -407,6 +407,18 @@ class ProcessorManager:
|
||||
"""Get detailed metrics for a target (any type)."""
|
||||
return self._get_processor(target_id).get_metrics()
|
||||
|
||||
def get_all_target_states(self) -> Dict[str, dict]:
|
||||
"""Get processing state for all targets (with device health merged)."""
|
||||
return {tid: self.get_target_state(tid) for tid in self._processors}
|
||||
|
||||
def get_all_target_metrics(self) -> Dict[str, dict]:
|
||||
"""Get metrics for all targets."""
|
||||
return {tid: proc.get_metrics() for tid, proc in self._processors.items()}
|
||||
|
||||
def get_all_device_health_dicts(self) -> Dict[str, dict]:
|
||||
"""Get health/connection state for all devices."""
|
||||
return {did: self.get_device_health_dict(did) for did in self._devices}
|
||||
|
||||
def is_target_processing(self, target_id: str) -> bool:
|
||||
"""Check if target is currently processing."""
|
||||
return self._get_processor(target_id).is_running
|
||||
|
||||
Reference in New Issue
Block a user