feature/IO-3096-GlobalNotifications - Check-point
This commit is contained in:
23
server/notifications/utils/notificationEmailQueue.js
Normal file
23
server/notifications/utils/notificationEmailQueue.js
Normal file
@@ -0,0 +1,23 @@
|
||||
const path = require("path");
|
||||
require("dotenv").config({
|
||||
path: path.resolve(process.cwd(), `.env.${process.env.NODE_ENV || "development"}`)
|
||||
});
|
||||
const Queue = require("better-queue");
|
||||
|
||||
const logger = require("../../utils/logger");
|
||||
|
||||
const notificationsEmailQueue = () =>
|
||||
new Queue(
|
||||
(taskIds, cb) => {
|
||||
logger.log("Processing Notification Emails: ", "silly", null, null);
|
||||
cb(null);
|
||||
},
|
||||
{
|
||||
batchSize: 50,
|
||||
batchDelay: 5000,
|
||||
// The lower this is, the more likely we are to hit the rate limit.
|
||||
batchDelayTimeout: 1000
|
||||
}
|
||||
);
|
||||
|
||||
module.exports = { notificationsEmailQueue };
|
||||
Reference in New Issue
Block a user