feature/IO-3492-FCM-Queue-For-Notifications: Implement FCM queue and worker for notifications
This commit is contained in:
@@ -14,6 +14,7 @@ const { isEmpty, isFunction } = require("lodash");
|
||||
const { getMatchingScenarios } = require("./scenarioMapper");
|
||||
const { dispatchEmailsToQueue } = require("./queues/emailQueue");
|
||||
const { dispatchAppsToQueue } = require("./queues/appQueue");
|
||||
const { dispatchFcmsToQueue } = require("./queues/fcmQueue"); // NEW
|
||||
|
||||
// If true, the user who commits the action will NOT receive notifications; if false, they will.
|
||||
const FILTER_SELF_FROM_WATCHERS = process.env?.FILTER_SELF_FROM_WATCHERS !== "false";
|
||||
@@ -298,6 +299,16 @@ const scenarioParser = async (req, jobIdField) => {
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
const fcmsToDispatch = scenariosToDispatch.map((scenario) => scenario?.fcm);
|
||||
if (!isEmpty(fcmsToDispatch)) {
|
||||
dispatchFcmsToQueue({ fcmsToDispatch, logger }).catch((e) =>
|
||||
logger.log("Something went wrong dispatching FCMs to the FCM Notification Queue", "error", "queue", null, {
|
||||
message: e?.message,
|
||||
stack: e?.stack
|
||||
})
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = scenarioParser;
|
||||
|
||||
Reference in New Issue
Block a user