Fix errors maybe?

This commit is contained in:
ld3zian 2025-02-04 19:29:03 -07:00
parent 22c3e665e8
commit 66e9dd2a06
3 changed files with 21 additions and 4 deletions

View file

@ -9,4 +9,9 @@ export default defineConfig({
remotePatterns: [{ protocol: "https" }], remotePatterns: [{ protocol: "https" }],
}, },
integrations: [tailwind()], integrations: [tailwind()],
vite: {
define: {
'process.env.REDIS_URL': JSON.stringify(process.env.REDIS_URL)
}
}
}); });

View file

@ -294,7 +294,8 @@ export async function getChaptersForSlugs(
}); });
// Add progress tracking // Add progress tracking
console.log(`Cache hits: ${cachedChapters.length} chapters from ${slugs.length - slugsToFetch.length} comics`); const cachedSlugs = new Set(cachedChapters.map(c => c.md_comics.slug));
console.log(`Cache hits: ${cachedChapters.length} chapters from ${cachedSlugs.size} comics`);
console.log(`Fetching ${slugsToFetch.length} comics from API`); console.log(`Fetching ${slugsToFetch.length} comics from API`);
const fetchPromises = slugsToFetch.map(async (slug) => { const fetchPromises = slugsToFetch.map(async (slug) => {

View file

@ -19,8 +19,8 @@ async function createRedisClient(): Promise<Redis> {
console.log(`Redis retry attempt ${times}, next try in ${delay}ms`); console.log(`Redis retry attempt ${times}, next try in ${delay}ms`);
return delay + Math.random() * 200; // Add jitter return delay + Math.random() * 200; // Add jitter
}, },
maxRetriesPerRequest: 1, maxRetriesPerRequest: null, // Allow retries for queued commands
enableOfflineQueue: false, enableOfflineQueue: true, // Enable command queuing
enableReadyCheck: true, enableReadyCheck: true,
reconnectOnError: (err) => { reconnectOnError: (err) => {
return err.message.includes('READONLY'); return err.message.includes('READONLY');
@ -150,3 +150,14 @@ export async function getFeedMapping(feedId: string): Promise<FeedMapping | null
} }
// No need for manual cleanup as we're using TTL (expire) // No need for manual cleanup as we're using TTL (expire)
// Warm connection on startup
(async () => {
try {
const client = await getRedisClient();
await client.ping();
console.log('Redis pre-connected successfully');
} catch (error) {
console.error('Redis pre-connection failed:', error);
}
})();