Fixes: Redis keys related to queue jobs should be removed after completion
This commit is contained in:
@@ -19,18 +19,21 @@ const globalEventsQueue = new Queue('global events', process.env.REDIS_URL);
|
||||
const serviceEventsQueue = new Queue('service events', process.env.REDIS_URL);
|
||||
|
||||
// this queue processes global events and hands them off to service hooks
|
||||
globalEventsQueue.process(async function(job) {
|
||||
globalEventsQueue.process(async job => {
|
||||
const names = Object.keys(services);
|
||||
names.forEach(name => {
|
||||
const service = services[name];
|
||||
if (service.on) {
|
||||
serviceEventsQueue.add({ service: name, ...job.data });
|
||||
serviceEventsQueue.add(
|
||||
{ service: name, ...job.data },
|
||||
{ removeOnComplete: true }
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// this queue processes an individual event for a specific service
|
||||
serviceEventsQueue.process(async function(job) {
|
||||
serviceEventsQueue.process(async job => {
|
||||
const event = job.data;
|
||||
const service = services[event.service];
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ const logisticsQueue = new Queue('logistics', process.env.REDIS_URL);
|
||||
const mailer = new Mailer();
|
||||
const queueOptions = {
|
||||
attempts: 2,
|
||||
removeOnComplete: true,
|
||||
backoff: {
|
||||
type: 'exponential',
|
||||
delay: 60 * 1000,
|
||||
|
||||
@@ -138,6 +138,7 @@ export const sendEmail = (type: Emails, to: string, options?: Object = {}) => {
|
||||
},
|
||||
{
|
||||
attempts: 5,
|
||||
removeOnComplete: true,
|
||||
backoff: {
|
||||
type: 'exponential',
|
||||
delay: 60 * 1000,
|
||||
|
||||
Reference in New Issue
Block a user