Some checks failed
Deploy to Test Environment / deploy-to-test (push) Failing after 41s
76 lines
1.6 KiB
TypeScript
76 lines
1.6 KiB
TypeScript
import { Queue } from 'bullmq';
|
|
import { connection } from './redis.server';
|
|
import type {
|
|
FlyerJobData,
|
|
EmailJobData,
|
|
AnalyticsJobData,
|
|
WeeklyAnalyticsJobData,
|
|
CleanupJobData,
|
|
TokenCleanupJobData,
|
|
} from '../types/job-data';
|
|
|
|
// --- Queues ---
|
|
|
|
export const flyerQueue = new Queue<FlyerJobData>('flyer-processing', {
|
|
connection,
|
|
defaultJobOptions: {
|
|
attempts: 3,
|
|
backoff: {
|
|
type: 'exponential',
|
|
delay: 5000,
|
|
},
|
|
},
|
|
});
|
|
|
|
export const emailQueue = new Queue<EmailJobData>('email-sending', {
|
|
connection,
|
|
defaultJobOptions: {
|
|
attempts: 5,
|
|
backoff: {
|
|
type: 'exponential',
|
|
delay: 10000,
|
|
},
|
|
},
|
|
});
|
|
|
|
export const analyticsQueue = new Queue<AnalyticsJobData>('analytics-reporting', {
|
|
connection,
|
|
defaultJobOptions: {
|
|
attempts: 2,
|
|
backoff: {
|
|
type: 'exponential',
|
|
delay: 60000,
|
|
},
|
|
removeOnComplete: true,
|
|
removeOnFail: 50,
|
|
},
|
|
});
|
|
|
|
export const weeklyAnalyticsQueue = new Queue<WeeklyAnalyticsJobData>('weekly-analytics-reporting', {
|
|
connection,
|
|
defaultJobOptions: {
|
|
attempts: 2,
|
|
backoff: { type: 'exponential', delay: 3600000 },
|
|
removeOnComplete: true,
|
|
removeOnFail: 50,
|
|
},
|
|
});
|
|
|
|
export const cleanupQueue = new Queue<CleanupJobData>('file-cleanup', {
|
|
connection,
|
|
defaultJobOptions: {
|
|
attempts: 3,
|
|
backoff: { type: 'exponential', delay: 30000 },
|
|
removeOnComplete: true,
|
|
},
|
|
});
|
|
|
|
export const tokenCleanupQueue = new Queue<TokenCleanupJobData>('token-cleanup', {
|
|
connection,
|
|
defaultJobOptions: {
|
|
attempts: 2,
|
|
backoff: { type: 'exponential', delay: 3600000 },
|
|
removeOnComplete: true,
|
|
removeOnFail: 10,
|
|
},
|
|
}); |