fix: #9339, only log email errors once per digest, notification push

show notice in acp
This commit is contained in:
Barış Soner Uşaklı
2021-03-05 19:03:16 -05:00
parent 3f42d40c78
commit 3aa26c4df2
6 changed files with 35 additions and 7 deletions

View File

@@ -186,6 +186,7 @@ async function pushToUids(uids, notification) {
}
body = posts.relativeToAbsolute(body, posts.urlRegex);
body = posts.relativeToAbsolute(body, posts.imgRegex);
let errorLogged = false;
await async.eachLimit(uids, 3, async (uid) => {
await emailer.send('notification', uid, {
path: notification.path,
@@ -195,7 +196,12 @@ async function pushToUids(uids, notification) {
body: body,
notification: notification,
showUnsubscribe: true,
}).catch(err => winston.error(`[emailer.send] ${err.stack}`));
}).catch((err) => {
if (!errorLogged) {
winston.error(`[emailer.send] ${err.stack}`);
errorLogged = true;
}
});
});
}