perf: optimize dashboard loading and builds

This commit is contained in:
Thomas Camlong committed 2026-08-02 15:58:16 +02:00
1 parent d90e762e4b
commit de801f3f00
135 files changed
+8521 -1718

No files matched your search

-3
View File
@@ -7,9 +7,6 @@ export {
createSubPubChannel,
createGetSetChannel,
createLockChannel,
setQueryCacheAsync,
getQueryCacheAsync,
removeQueryCacheAsync,
invalidateIntegrationCacheAsync,
} from "./lib/channel";
-31
View File
@@ -1,13 +1,10 @@
import superjson from "superjson";
import { createId } from "@homarr/common";
import { createLogger } from "@homarr/core/infrastructure/logs";
import { ChannelSubscriptionTracker } from "./channel-subscription-tracker";
import { createRedisConnection } from "./connection";
const logger = createLogger({ module: "redisChannel" });
const publisher = createRedisConnection();
const lastDataClient = createRedisConnection();
@@ -159,34 +156,6 @@ export const createLockChannel = (name: string) => {
};
};
const queryCacheKey = (userId: string, boardId: string) => `qc:${userId}:${boardId}`;
export const setQueryCacheAsync = async (
userId: string,
boardId: string,
value: string,
ttlMs: number,
maxValueBytes: number,
) => {
if (Buffer.byteLength(value, "utf8") > maxValueBytes) {
logger.warn("Query cache value exceeded maximum size", {
key: queryCacheKey(userId, boardId),
valueBytes: Buffer.byteLength(value, "utf8"),
maxValueBytes,
});
return false;
}
await getSetClient.set(queryCacheKey(userId, boardId), value, "PX", ttlMs);
return true;
};
export const getQueryCacheAsync = async (userId: string, boardId: string) =>
await getSetClient.get(queryCacheKey(userId, boardId));
export const removeQueryCacheAsync = async (userId: string, boardId: string) => {
await getSetClient.del(queryCacheKey(userId, boardId));
};
export const invalidateIntegrationCacheAsync = async (integrationId: string): Promise<void> => {
const client = getSetClient as typeof getSetClient | null;
if (!client) return;