fix: catch exceptions from sendNotifications

isekai-main
Barış Soner Uşaklı 3 years ago
parent d7796f0b73
commit c1ec20470b

@ -1,5 +1,7 @@
'use strict';
const winston = require('winston');
const user = require('../user');
const notifications = require('../notifications');
const sockets = require('../socket.io');
@ -45,8 +47,12 @@ module.exports = function (Messaging) {
Messaging.notifyQueue[`${fromUid}:${roomId}`] = queueObj;
}
queueObj.timeout = setTimeout(() => {
sendNotifications(fromUid, uids, roomId, queueObj.message);
queueObj.timeout = setTimeout(async () => {
try {
await sendNotifications(fromUid, uids, roomId, queueObj.message);
} catch (err) {
winston.error(`[messaging/notifications] Unabled to send notification\n${err.stack}`);
}
}, meta.config.notificationSendDelay * 1000);
};

Loading…
Cancel
Save