fix(core): own cache transports and accept cleanup reviews

This commit is contained in:
Boki 2026-10-26 23:57:39 -04:00
parent bd9332b2f6
commit b4ac6460ef
24 changed files with 504 additions and 97 deletions

View file

@ -61,13 +61,15 @@ export class QueueManager {
this.redisConnection = getRedisConnection(config.redis);
// Create ioredis connection for rate limiter
const retryDelay = config.redis.retryDelay;
this.ioredisConnection = new Redis({
host: config.redis.host,
port: config.redis.port,
password: config.redis.password,
username: config.redis.username,
db: config.redis.db || 0,
maxRetriesPerRequest: 3,
maxRetriesPerRequest: config.redis.maxRetriesPerRequest ?? 3,
...(retryDelay === undefined ? {} : { retryStrategy: () => retryDelay }),
enableReadyCheck: true,
});
@ -205,6 +207,7 @@ export class QueueManager {
if (!this.caches.has(queueName)) {
const cacheProvider = createCache({
redisConfig: this.config.redis,
shared: false,
keyPrefix: `batch:${queueName}:`,
ttl: 86400, // 24 hours default
enableMetrics: true,
@ -499,6 +502,8 @@ export class QueueManager {
await cache.clear();
} catch (error) {
this.logger.warn('Error clearing cache', { error: (error as Error).message });
} finally {
await cache.disconnect?.();
}
});