mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-09-23 04:34:15 -04:00
[cards][admin] notify if the queue gets too long
This commit is contained in:
parent
42d527b08a
commit
19165c0dfc
@ -86,6 +86,11 @@ const templates = {
|
||||
</p>
|
||||
`,
|
||||
},
|
||||
cardsWarning: {
|
||||
subject: 'Cards queue is getting long',
|
||||
text: 'There\'s {{count}} cards in the queue!',
|
||||
html: '<p>There\'s {{count}} cards in the queue!</p>',
|
||||
}
|
||||
}
|
||||
|
||||
const applyTemplate = (template, context, params) => {
|
||||
|
@ -1,4 +1,5 @@
|
||||
const {decodeTime} = require('ulid');
|
||||
const mailer = require('./mailer');
|
||||
|
||||
// TODO all the duplication...
|
||||
const buildDict = (fn, ...args) => {
|
||||
@ -113,5 +114,9 @@ module.exports.calculateStats = async (db, allLocales) => {
|
||||
|
||||
const cardsQueue = (await db.get(`SELECT count(*) as c FROM profiles WHERE card = '' OR cardDark = ''`)).c;
|
||||
|
||||
if (cardsQueue > 64) {
|
||||
mailer('andrea@avris.it', 'cardsWarning', {count: cardsQueue});
|
||||
}
|
||||
|
||||
return { calculatedAt: parseInt(new Date() / 1000), users, locales, cardsQueue };
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user