29 lines
656 B
TypeScript
29 lines
656 B
TypeScript
import { Queue } from 'bullmq';
|
|
import { sharedRedisConnection } from './redisConnection';
|
|
import logger from '@utils/logger';
|
|
|
|
let tatQueue: Queue | null = null;
|
|
|
|
try {
|
|
// Use shared Redis connection for both Queue and Worker
|
|
tatQueue = new Queue('tatQueue', {
|
|
connection: sharedRedisConnection,
|
|
defaultJobOptions: {
|
|
removeOnComplete: true,
|
|
removeOnFail: false,
|
|
attempts: 2,
|
|
backoff: {
|
|
type: 'fixed',
|
|
delay: 5000
|
|
}
|
|
}
|
|
});
|
|
logger.info('[TAT Queue] Queue initialized');
|
|
} catch (error) {
|
|
logger.error('[TAT Queue] Failed to initialize:', error);
|
|
tatQueue = null;
|
|
}
|
|
|
|
export { tatQueue };
|
|
|