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];
|
||||
|
||||
|
Reference in New Issue
Block a user