This commit is contained in:
Boki 2025-06-19 08:31:21 -04:00
parent d3ef73ae00
commit a2fa08de88
8 changed files with 72 additions and 68 deletions

View file

@ -1,17 +1,10 @@
import { Queue, type Job } from 'bullmq';
import { getLogger } from '@stock-bot/logger';
import type { JobData } from './types';
import type { JobData, DLQConfig, RedisConfig } from './types';
import { getRedisConnection } from './utils';
const logger = getLogger('dlq-handler');
export interface DLQConfig {
maxRetries?: number;
retryDelay?: number;
alertThreshold?: number;
cleanupAge?: number; // hours
}
export class DeadLetterQueueHandler {
private dlq: Queue;
private config: Required<DLQConfig>;
@ -19,7 +12,7 @@ export class DeadLetterQueueHandler {
constructor(
private mainQueue: Queue,
private connection: any,
private connection: RedisConfig,
config: DLQConfig = {}
) {
this.config = {