diff --git a/src/healthchecksio.tsx b/src/healthchecksio.tsx index dd173f9..f82c233 100644 --- a/src/healthchecksio.tsx +++ b/src/healthchecksio.tsx @@ -1,6 +1,6 @@ import { useState } from "react"; import useSWR from "swr"; -import { groupBy, healthchecksioFetcher, removePrefix, removeSuffix } from "./utils"; +import { groupBy, healthchecksioFetcher, removePrefix, removeSuffix, timeSinceShort } from "./utils"; import { STATUS_SYMBOLS } from "./constants"; import { StatusSummary } from "./summary"; import { OptionGroup } from "./option-group"; @@ -76,7 +76,7 @@ function shortenCheckName(groupKey: typeof GROUP_KEYS[number], groupName: string export function HealthchecksioStatus({ showInternal, initialGroupKey = "" }: { showInternal?: boolean, initialGroupKey?: string }) { const [groupKey, setGroupKey] = useState((GROUP_KEYS.includes(initialGroupKey as any) ? initialGroupKey : GROUP_KEYS[0]) as typeof GROUP_KEYS[number]); - const { data: dataRaw, error, isLoading } = useSWR('/api/v3/checks/', healthchecksioFetcher, { refreshInterval: 10000 }); + const { data: dataRaw, error, isLoading } = useSWR('/api/v3/checks/', healthchecksioFetcher, { refreshInterval: 5000 }); const checks = (processHCData(dataRaw) || []).filter(check => check.tags_dict.public !== 'False' || showInternal); const groupedChecks = groupBy(checks, c => c.tags_dict[groupKey]); @@ -99,14 +99,15 @@ export function HealthchecksioStatus({ showInternal, initialGroupKey = "" }: { s selectedClassName="bg-blue-500 text-white" /> -