feat: replace server-side Redis caching with TanStack Query AsyncStoragePersister
Consolidate two overlapping cache systems (broken TanStack persister + per-query Redis hash + pub/sub) into one: TanStack Query as single source of truth with Redis as its persistence layer via createAsyncStoragePersister. - Replace QueryClientProvider with PersistQueryClientProvider backed by Redis - Set global query defaults (staleTime: 0, refetchInterval: 30s, gcTime: 24h) - Remove all per-widget staleTime/refetchInterval/retry/refetchOnWindowFocus overrides - Replace cached request handlers with simplified fetch-only versions - Remove all tRPC subscription procedures and useSubscription calls in favor of polling - Delete 20 cron jobs that only pre-warmed server-side cache - Simplify Redis from per-query hash to single blob per user+board
This commit is contained in:
165 files changed
+546
-3456
No files matched your search
@@ -184,20 +184,11 @@ export default function DockerWidget({ options, width, isEditMode }: WidgetCompo
|
||||
const t = useScopedI18n("docker");
|
||||
const isTiny = width <= 256;
|
||||
|
||||
const utils = clientApi.useUtils();
|
||||
const { data } = clientApi.docker.getContainers.useQuery(undefined, {
|
||||
staleTime: 20 * 1000,
|
||||
});
|
||||
const { data } = clientApi.docker.getContainers.useQuery(undefined);
|
||||
const containers = data?.containers ?? [];
|
||||
const timestamp = useMemo(() => data?.timestamp ?? new Date(), [data?.timestamp]);
|
||||
const relativeTime = useTimeAgo(timestamp);
|
||||
|
||||
clientApi.docker.subscribeContainers.useSubscription(undefined, {
|
||||
onData(data) {
|
||||
utils.docker.getContainers.setData(undefined, { containers: data, timestamp: new Date() });
|
||||
},
|
||||
});
|
||||
|
||||
const totalContainers = containers.length;
|
||||
|
||||
const totals = useMemo(() => {
|
||||
|
||||
Reference in new issue
Block a user