The v1.69.0 caching refactor (f19033e0d) replaced the old Redis-backed
cached request handler with a simpler in-memory handler but dropped
all per-handler cacheDuration values, defaulting everything to 10s.
This caused widgets that previously had short cache durations (e.g.
health-monitoring at 5s, dns-hole at 5s) to refresh much less
frequently since the client polls every 30s.
Restores cacheTtlMs for all affected request handlers to match their
pre-v1.69.0 values. Also adds cacheTtlMs support to
createWidgetRequestHandler which was missing it.
Beszel handlers are intentionally left untouched as they have their
own cache handling.
Fixes #6268
18 lines
647 B
TypeScript
18 lines
647 B
TypeScript
import type { IntegrationKindByCategory } from "@homarr/definitions";
|
|
import { createIntegrationAsync } from "@homarr/integrations";
|
|
import type { DnsHoleSummary } from "@homarr/integrations/types";
|
|
|
|
import { createIntegrationRequestHandler } from "./lib/integration-request-handler";
|
|
|
|
export const dnsHoleRequestHandler = createIntegrationRequestHandler<
|
|
DnsHoleSummary,
|
|
IntegrationKindByCategory<"dnsHole">,
|
|
Record<string, never>
|
|
>({
|
|
async requestAsync(integration, _input) {
|
|
const integrationInstance = await createIntegrationAsync(integration);
|
|
return await integrationInstance.getSummaryAsync();
|
|
},
|
|
cacheTtlMs: 5_000,
|
|
});
|