feature/IO-3492-FCM-Queue-For-Notifications: Implement FCM queue and worker for notifications
This commit is contained in:
@@ -75,7 +75,9 @@ const loadEmailQueue = async ({ pubClient, logger }) => {
|
||||
await pubClient.hsetnx(detailsKey, "lastName", lastName || "");
|
||||
await pubClient.hsetnx(detailsKey, "bodyShopTimezone", bodyShopTimezone);
|
||||
await pubClient.expire(detailsKey, NOTIFICATION_EXPIRATION / 1000);
|
||||
await pubClient.sadd(`email:${devKey}:recipients:${jobId}`, user);
|
||||
const recipientsSetKey = `email:${devKey}:recipients:${jobId}`;
|
||||
await pubClient.sadd(recipientsSetKey, user);
|
||||
await pubClient.expire(recipientsSetKey, NOTIFICATION_EXPIRATION / 1000);
|
||||
devDebugLogger(`Stored message for ${user} under ${userKey}: ${body}`);
|
||||
}
|
||||
|
||||
@@ -239,7 +241,13 @@ const dispatchEmailsToQueue = async ({ emailsToDispatch, logger }) => {
|
||||
const emailAddQueue = getQueue();
|
||||
|
||||
for (const email of emailsToDispatch) {
|
||||
const { jobId, jobRoNumber, bodyShopName, bodyShopTimezone, body, recipients } = email;
|
||||
const { jobId, bodyShopName, bodyShopTimezone, body, recipients } = email;
|
||||
let { jobRoNumber } = email;
|
||||
|
||||
// Make sure Jobs that have not been coverted yet can still get notifications
|
||||
if (jobRoNumber === null) {
|
||||
jobRoNumber = "N/A";
|
||||
}
|
||||
|
||||
if (!jobId || !jobRoNumber || !bodyShopName || !body || !recipients.length) {
|
||||
devDebugLogger(
|
||||
|
||||
Reference in New Issue
Block a user