From fbc099d1984938fd02a761c0ee61be0b40d16cc0 Mon Sep 17 00:00:00 2001 From: Manuel <30572287+manuel-rw@users.noreply.github.com> Date: Sun, 4 Aug 2024 17:47:31 +0200 Subject: [PATCH] fix: #1707 refech interval app pings (#2097) --- src/components/Dashboard/Tiles/Apps/AppPing.tsx | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/components/Dashboard/Tiles/Apps/AppPing.tsx b/src/components/Dashboard/Tiles/Apps/AppPing.tsx index be58ec2ea..4b3e4a4b8 100644 --- a/src/components/Dashboard/Tiles/Apps/AppPing.tsx +++ b/src/components/Dashboard/Tiles/Apps/AppPing.tsx @@ -108,18 +108,19 @@ const usePing = (app: AppType) => { configName: name ?? '', }, { - retry: false, + retry: true, enabled: isActive, refetchOnWindowFocus: false, + refetchInterval: 1000 * 60, retryDelay(failureCount, error) { - // TODO: Add logic to retry on timeout - return 3000; + console.error(`Unable to retry app ping for app '${app.name}' (${app.id})`, error); + if (failureCount > 3) { + return 60 * 1000; + } + return 3 * 1000; }, - // 5 minutes of cache - cacheTime: 1000 * 60 * 5, - staleTime: 1000 * 60 * 5, + cacheTime: 1000 * 60, retryOnMount: true, - select: (data) => { const isOk = isStatusOk(app, data.status); if (isOk)