diff --git a/packages/api/src/router/query-cache.ts b/packages/api/src/router/query-cache.ts index 875c96135..e2aa77b9b 100644 --- a/packages/api/src/router/query-cache.ts +++ b/packages/api/src/router/query-cache.ts @@ -25,7 +25,13 @@ export const queryCacheRouter = createTRPCRouter({ await validateBoardAccessAsync(ctx, input.boardId); const userId = ctx.session?.user.id ?? "anonymous"; return { - stored: await setQueryCacheAsync(userId, input.boardId, input.value, queryCacheDefaultGcTimeMs, queryCacheMaxValueBytes), + stored: await setQueryCacheAsync( + userId, + input.boardId, + input.value, + queryCacheDefaultGcTimeMs, + queryCacheMaxValueBytes, + ), }; }), removeItem: publicProcedure.input(queryCacheBoardInput).mutation(async ({ ctx, input }) => { diff --git a/packages/api/src/test/query-cache.spec.ts b/packages/api/src/test/query-cache.spec.ts index 8069b239d..0b119c28f 100644 --- a/packages/api/src/test/query-cache.spec.ts +++ b/packages/api/src/test/query-cache.spec.ts @@ -19,11 +19,13 @@ const redisMock = vi.hoisted(() => { return { values, - setQueryCacheAsync: vi.fn(async (_userId: string, _boardId: string, value: string, _ttlMs: number, maxValueBytes: number) => { - if (Buffer.byteLength(value, "utf8") > maxValueBytes) return false; - values.set(`${_userId}:${_boardId}`, value); - return true; - }), + setQueryCacheAsync: vi.fn( + async (_userId: string, _boardId: string, value: string, _ttlMs: number, maxValueBytes: number) => { + if (Buffer.byteLength(value, "utf8") > maxValueBytes) return false; + values.set(`${_userId}:${_boardId}`, value); + return true; + }, + ), removeQueryCacheAsync: vi.fn(async (_userId: string, _boardId: string) => { values.delete(`${_userId}:${_boardId}`); }), diff --git a/packages/redis/src/lib/channel.ts b/packages/redis/src/lib/channel.ts index 3f59b39e6..7cb84be68 100644 --- a/packages/redis/src/lib/channel.ts +++ b/packages/redis/src/lib/channel.ts @@ -130,7 +130,13 @@ export const createGetSetChannel = (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) => { +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),