- aggiornato sistema per inviare le newsletter !

This commit is contained in:
Surya Paolo
2024-02-08 01:34:30 +01:00
parent 2151502d30
commit dacfc5a844
8 changed files with 223 additions and 85 deletions

View File

@@ -348,6 +348,7 @@ async function mystart() {
console.log('decrypted:', decrypt);
}
mycron();
if (!process.env.DEBUG) {
mycron();
}
@@ -394,14 +395,20 @@ function populateDBadmin() {
let cfg = new CfgServer(cfgserv[0]).save();
}
function mycron() {
async function mycron() {
const sendemail = require('./sendemail');
try {
const sendemail = require('./sendemail');
for (const app of tools.getApps()) {
sendemail.checkifPendingNewsletter(app.idapp);
sendemail.checkifSentNewsletter(app.idapp);
const arr = await tools.getApps();
for (const app of arr) {
sendemail.checkifPendingNewsletter(app.idapp);
sendemail.checkifSentNewsletter(app.idapp);
}
} catch (e) {
console.error('Err mycron', e);
}
}
@@ -442,11 +449,11 @@ function testmsgwebpush() {
}
// Cron every X minutes
cron.schedule('*/2 * * * *', () => {
cron.schedule('*/1 * * * *', () => {
// console.log('Running Cron Job');
if (!process.env.DEBUG) {
// if (!process.env.DEBUG) {
mycron();
}
// }
});
// Cron every X minutes