mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
fix: catch exceptions from sendNotifications
This commit is contained in:
@@ -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);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user