-
Notifications
You must be signed in to change notification settings - Fork 222
Open
Labels
Description
const sharedConfig: BeeQueue.QueueSettings = {
isWorker: false,
redis: redisClient,
removeOnSuccess: true,
activateDelayedJobs: true,
delayedDebounce: 1000,
};
export const QueueWorkers: { [key in QueueWorkersName]: BeeQueue } = {
[QueueWorkersName.SEND_NOTIFICATION]: new BeeQueue<NotificationJobData>(QueueWorkersName.SEND_NOTIFICATION, sharedConfig),
};
export async function addNotificationJob(data: NotificationJobData, delayDate: Date = new Date()): Promise<string> {
const job = await QueueWorkers[QueueWorkersName.SEND_NOTIFICATION].createJob(data);
if (delayDate.getTime() > Date.now()) {
job.delayUntil(delayDate);
}
job.save();
return job.id;
}Reactions are currently unavailable