fix(cache): reduce Valkey connectTimeout to 1.5s to avoid 10s hang

When Valkey is unreachable, ioredis was holding cache.get() calls in
the offline queue for the default 10s connectTimeout before failing.
This caused admin/image-gen and text-gen pages to stall on every load.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Admin
2026-04-05 22:04:05 +05:00
parent 5d7c3b42fa
commit a308672317

View File

@@ -20,7 +20,8 @@ function client(): Redis {
_client = new Redis(url, { _client = new Redis(url, {
lazyConnect: false, lazyConnect: false,
enableOfflineQueue: true, enableOfflineQueue: true,
maxRetriesPerRequest: 2 maxRetriesPerRequest: 1,
connectTimeout: 1500
}); });
_client.on('error', (err: Error) => { _client.on('error', (err: Error) => {
console.error('[cache] Valkey error:', err.message); console.error('[cache] Valkey error:', err.message);