Reduce automatic pinging
This commit is contained in:
@@ -415,7 +415,8 @@ app.listen(PORT, async () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
setInterval(() => {
|
// Disable automatic background polling to prevent log flooding
|
||||||
pollStatusesOnce().catch(err => logger.error('Background poll failed', err));
|
// setInterval(() => {
|
||||||
}, 60_000);
|
// pollStatusesOnce().catch(err => logger.error('Background poll failed', err));
|
||||||
|
// }, 60_000);
|
||||||
|
|
||||||
|
|||||||
@@ -238,7 +238,7 @@ export function LeftSidebar({
|
|||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
fetchHosts();
|
fetchHosts();
|
||||||
const interval = setInterval(fetchHosts, 10000);
|
const interval = setInterval(fetchHosts, 300000); // 5 minutes instead of 10 seconds
|
||||||
return () => clearInterval(interval);
|
return () => clearInterval(interval);
|
||||||
}, [fetchHosts]);
|
}, [fetchHosts]);
|
||||||
|
|
||||||
|
|||||||
@@ -94,20 +94,23 @@ export function Server({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (currentHostConfig?.id) {
|
if (currentHostConfig?.id && isVisible) {
|
||||||
fetchStatus();
|
fetchStatus();
|
||||||
fetchMetrics();
|
fetchMetrics();
|
||||||
|
// Only poll when component is visible to reduce unnecessary connections
|
||||||
intervalId = window.setInterval(() => {
|
intervalId = window.setInterval(() => {
|
||||||
|
if (isVisible) {
|
||||||
fetchStatus();
|
fetchStatus();
|
||||||
fetchMetrics();
|
fetchMetrics();
|
||||||
}, 10_000);
|
}
|
||||||
|
}, 300_000); // 5 minutes instead of 10 seconds
|
||||||
}
|
}
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
cancelled = true;
|
cancelled = true;
|
||||||
if (intervalId) window.clearInterval(intervalId);
|
if (intervalId) window.clearInterval(intervalId);
|
||||||
};
|
};
|
||||||
}, [currentHostConfig?.id]);
|
}, [currentHostConfig?.id, isVisible]);
|
||||||
|
|
||||||
const topMarginPx = isTopbarOpen ? 74 : 16;
|
const topMarginPx = isTopbarOpen ? 74 : 16;
|
||||||
const leftMarginPx = sidebarState === 'collapsed' ? 16 : 8;
|
const leftMarginPx = sidebarState === 'collapsed' ? 16 : 8;
|
||||||
@@ -142,7 +145,26 @@ export function Server({
|
|||||||
<StatusIndicator/>
|
<StatusIndicator/>
|
||||||
</Status>
|
</Status>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center">
|
<div className="flex items-center gap-2">
|
||||||
|
<Button
|
||||||
|
variant="outline"
|
||||||
|
onClick={async () => {
|
||||||
|
if (currentHostConfig?.id) {
|
||||||
|
try {
|
||||||
|
const res = await getServerStatusById(currentHostConfig.id);
|
||||||
|
setServerStatus(res?.status === 'online' ? 'online' : 'offline');
|
||||||
|
const data = await getServerMetricsById(currentHostConfig.id);
|
||||||
|
setMetrics(data);
|
||||||
|
} catch {
|
||||||
|
setServerStatus('offline');
|
||||||
|
setMetrics(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
title="Refresh status and metrics"
|
||||||
|
>
|
||||||
|
Refresh
|
||||||
|
</Button>
|
||||||
{currentHostConfig?.enableFileManager && (
|
{currentHostConfig?.enableFileManager && (
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
|
|||||||
Reference in New Issue
Block a user