Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8c1e72819a | ||
|
|
a0fb7553a5 |
No files matched your search
@@ -29,6 +29,7 @@ import {
|
|||||||
queryCacheDefaultGcTimeMs,
|
queryCacheDefaultGcTimeMs,
|
||||||
queryCacheDefaultRefetchIntervalMs,
|
queryCacheDefaultRefetchIntervalMs,
|
||||||
queryCacheDefaultStaleTimeMs,
|
queryCacheDefaultStaleTimeMs,
|
||||||
|
widgetRefetchIntervalOverrides,
|
||||||
} from "@homarr/api/query-cache";
|
} from "@homarr/api/query-cache";
|
||||||
import { createHeadersCallbackForSource, getTrpcUrl } from "@homarr/api/shared";
|
import { createHeadersCallbackForSource, getTrpcUrl } from "@homarr/api/shared";
|
||||||
import { env } from "@homarr/common/env";
|
import { env } from "@homarr/common/env";
|
||||||
@@ -90,6 +91,9 @@ export function TRPCReactProvider(props: PropsWithChildren) {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
client.setQueryDefaults([["widget"]], { refetchInterval: queryCacheDefaultRefetchIntervalMs });
|
client.setQueryDefaults([["widget"]], { refetchInterval: queryCacheDefaultRefetchIntervalMs });
|
||||||
|
for (const [path, interval] of Object.entries(widgetRefetchIntervalOverrides)) {
|
||||||
|
client.setQueryDefaults([path.split(".")], { refetchInterval: interval });
|
||||||
|
}
|
||||||
return client;
|
return client;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,44 @@ export const queryCacheMaxValueBytes = 1024 * 1024;
|
|||||||
export const queryCacheStoragePrefix = "homarr-widget-query";
|
export const queryCacheStoragePrefix = "homarr-widget-query";
|
||||||
export const queryCacheBuster = "v2-superjson";
|
export const queryCacheBuster = "v2-superjson";
|
||||||
|
|
||||||
|
export const widgetRefetchIntervalOverrides: Record<string, number> = {
|
||||||
|
"widget.healthMonitoring": 5_000,
|
||||||
|
"widget.dnsHole": 5_000,
|
||||||
|
"widget.downloads": 5_000,
|
||||||
|
"widget.mediaServer": 5_000,
|
||||||
|
"widget.tracearr": 5_000,
|
||||||
|
"widget.firewall.getFirewallCpuStatus": 5_000,
|
||||||
|
"widget.firewall.getFirewallMemoryStatus": 15_000,
|
||||||
|
"widget.firewall.getFirewallInterfacesStatus": 30_000,
|
||||||
|
"widget.firewall.getFirewallVersionStatus": 3_600_000,
|
||||||
|
"widget.anchorNotes": 15_000,
|
||||||
|
"widget.coolify": 30_000,
|
||||||
|
"widget.umami.getActiveVisitors": 30_000,
|
||||||
|
"widget.umami": 300_000,
|
||||||
|
"widget.calendar": 60_000,
|
||||||
|
"widget.mediaRequests": 60_000,
|
||||||
|
"widget.smartHome": 60_000,
|
||||||
|
"widget.ups": 60_000,
|
||||||
|
"widget.uptimeKuma": 60_000,
|
||||||
|
"widget.weather": 60_000,
|
||||||
|
"widget.timetable": 60_000,
|
||||||
|
"widget.indexerManager": 300_000,
|
||||||
|
"widget.mediaRelease": 300_000,
|
||||||
|
"widget.mediaTranscoding": 300_000,
|
||||||
|
"widget.networkController": 300_000,
|
||||||
|
"widget.notifications": 300_000,
|
||||||
|
"widget.rssFeed": 300_000,
|
||||||
|
"widget.stockPrice": 300_000,
|
||||||
|
"widget.minecraft": 300_000,
|
||||||
|
"widget.vpn": 300_000,
|
||||||
|
"widget.archiveTeamWarrior": 300_000,
|
||||||
|
"widget.audiobookshelf": 600_000,
|
||||||
|
"widget.navidrome": 600_000,
|
||||||
|
"widget.speedtestTracker": 600_000,
|
||||||
|
"widget.immich": 900_000,
|
||||||
|
"widget.paperlessNgx": 900_000,
|
||||||
|
};
|
||||||
|
|
||||||
let activeQueryCacheBoardId: string | null = null;
|
let activeQueryCacheBoardId: string | null = null;
|
||||||
|
|
||||||
export const setActiveQueryCacheBoardId = (boardId: string | null) => {
|
export const setActiveQueryCacheBoardId = (boardId: string | null) => {
|
||||||
|
|||||||
@@ -184,12 +184,8 @@ export default function DockerWidget({ options, width, isEditMode }: WidgetCompo
|
|||||||
const t = useScopedI18n("docker");
|
const t = useScopedI18n("docker");
|
||||||
const isTiny = width <= 256;
|
const isTiny = width <= 256;
|
||||||
|
|
||||||
const {
|
const { data, refetch, isFetching } = clientApi.docker.getContainers.useQuery(undefined, {
|
||||||
data,
|
refetchInterval: 20_000,
|
||||||
refetch,
|
|
||||||
isFetching,
|
|
||||||
} = clientApi.docker.getContainers.useQuery(undefined, {
|
|
||||||
refetchInterval: 30_000,
|
|
||||||
});
|
});
|
||||||
const containers = data?.containers ?? [];
|
const containers = data?.containers ?? [];
|
||||||
const timestamp = useMemo(() => data?.timestamp ?? new Date(), [data?.timestamp]);
|
const timestamp = useMemo(() => data?.timestamp ?? new Date(), [data?.timestamp]);
|
||||||
@@ -304,9 +300,7 @@ export default function DockerWidget({ options, width, isEditMode }: WidgetCompo
|
|||||||
{t("table.totalMemory", { memory: formatBytes(totals.memory) })}
|
{t("table.totalMemory", { memory: formatBytes(totals.memory) })}
|
||||||
</Text>
|
</Text>
|
||||||
|
|
||||||
<Tooltip
|
<Tooltip label={t("table.refresh.lastUpdated", { when: relativeTime })}>
|
||||||
label={t("table.refresh.lastUpdated", { when: relativeTime })}
|
|
||||||
>
|
|
||||||
<ActionIcon
|
<ActionIcon
|
||||||
size="sm"
|
size="sm"
|
||||||
variant="transparent"
|
variant="transparent"
|
||||||
|
|||||||
Reference in new issue
Block a user