fixing things

This commit is contained in:
2026-01-07 16:50:10 -05:00
parent 0a0c0e313e
commit 5b0f6dba0f
7 changed files with 123 additions and 48 deletions

View File

@@ -11,6 +11,7 @@
import { createClient } from "redis";
import { env } from "~/env/server";
import { CACHE_CONFIG } from "~/config";
let redisClient: ReturnType<typeof createClient> | null = null;
let isConnecting = false;
@@ -171,7 +172,8 @@ export async function withCacheAndStale<T>(
logErrors?: boolean;
} = {}
): Promise<T> {
const { maxStaleMs = 7 * 24 * 60 * 60 * 1000, logErrors = true } = options;
const { maxStaleMs = CACHE_CONFIG.MAX_STALE_DATA_MS, logErrors = true } =
options;
// Try fresh cache
const cached = await cache.get<T>(key);