From 800f94354b1adb083eabc889b8df5766a0dc5bb5 Mon Sep 17 00:00:00 2001 From: shats Date: Sun, 22 Feb 2026 21:31:07 +0700 Subject: [PATCH] feat(PingServices): add cache refresh option to fetchPingServices function and update tooltip for manual refresh --- backend/routes/miscRoutes.js | 3 ++- frontend/src/Dashboard.jsx | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/backend/routes/miscRoutes.js b/backend/routes/miscRoutes.js index 691d408..d9a9d79 100644 --- a/backend/routes/miscRoutes.js +++ b/backend/routes/miscRoutes.js @@ -488,7 +488,8 @@ async function getPingServices(req, res) { const cacheKey = cacheSeconds > 0 ? PING_SERVICES_CACHE_KEY_PREFIX + (viaRouter ? 'router' : 'web') + '_' + String(serverId || '').replace(/[^a-zA-Z0-9.-]/g, '_') + '_' + String(gatewayIp || '').replace(/[^a-zA-Z0-9.]/g, '_') : null; - if (cacheKey) { + const skipCache = ['1', 'true', 'yes'].includes(String(req.query?.refresh || req.query?.nocache || '').toLowerCase()); + if (cacheKey && !skipCache) { try { const raw = await readS3TextObject(cacheKey).catch(() => null); if (raw?.body) { diff --git a/frontend/src/Dashboard.jsx b/frontend/src/Dashboard.jsx index 06d47bf..4941b1d 100644 --- a/frontend/src/Dashboard.jsx +++ b/frontend/src/Dashboard.jsx @@ -304,9 +304,9 @@ function Dashboard() { return () => { cancelled = true; }; }, []); - function fetchPingServices() { + function fetchPingServices(forceRefresh = false) { setPingLoading(true); - api.get('/ping-services') + api.get('/ping-services', { params: forceRefresh ? { refresh: 1 } : {} }) .then(({ data }) => { const next = data && typeof data === 'object' ? data : null; setPingServices((current) => { @@ -370,11 +370,11 @@ function Dashboard() { {/* Пинг до сервисов (список из настроек / Пинг сервисов) */}

Пинг сервисов

- +