feat(queue): auto clean up complete and fail jobs
This commit is contained in:
@@ -5,6 +5,7 @@ import { IJSONObject, ITriggerItem } from '@automatisch/types';
|
||||
import actionQueue from '../queues/action';
|
||||
import Step from '../models/step';
|
||||
import { processTrigger } from '../services/trigger';
|
||||
import { REMOVE_AFTER_30_DAYS_OR_150_JOBS, REMOVE_AFTER_7_DAYS_OR_50_JOBS } from '../helpers/remove-job-configuration';
|
||||
|
||||
type JobData = {
|
||||
flowId: string;
|
||||
@@ -32,7 +33,12 @@ export const worker = new Worker(
|
||||
stepId: nextStep.id,
|
||||
};
|
||||
|
||||
await actionQueue.add(jobName, jobPayload);
|
||||
const jobOptions = {
|
||||
removeOnComplete: REMOVE_AFTER_7_DAYS_OR_50_JOBS,
|
||||
removeOnFail: REMOVE_AFTER_30_DAYS_OR_150_JOBS,
|
||||
}
|
||||
|
||||
await actionQueue.add(jobName, jobPayload, jobOptions);
|
||||
},
|
||||
{ connection: redisConfig }
|
||||
);
|
||||
|
Reference in New Issue
Block a user