- Aggiunta della funzione Cron
- Flag: Pubblicati OnLine + Solo CagalogoGenerale + Dettagli
This commit is contained in:
@@ -291,9 +291,6 @@ connectToDatabase(connectionUrl, options)
|
||||
}
|
||||
|
||||
mycron();
|
||||
if (!process.env.VITE_DEBUG) {
|
||||
mycron();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -342,12 +339,15 @@ connectToDatabase(connectionUrl, options)
|
||||
try {
|
||||
const sendemail = require('./sendemail');
|
||||
|
||||
const arr = await tools.getApps();
|
||||
const { Cron } = require('./models/cron');
|
||||
|
||||
const arr = await tools.getApps();
|
||||
for (const app of arr) {
|
||||
await sendemail.checkifPendingNewsletter(app.idapp);
|
||||
await sendemail.checkifSentNewsletter(app.idapp);
|
||||
|
||||
await Cron.startJobCron(app.idapp);
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Err mycron', e);
|
||||
@@ -413,7 +413,15 @@ connectToDatabase(connectionUrl, options)
|
||||
|
||||
}
|
||||
|
||||
// Cron every X minutes
|
||||
|
||||
// Esecuzione ogni 1 minuto (*/1 * * * *)
|
||||
// La sintassi di cron è:
|
||||
// 0 12 * * * comando
|
||||
// che significa: esegui il comando ogni giorno alle 12:00
|
||||
// La sintassi di node-cron è:
|
||||
// cron.schedule('0 12 * * *', () => {
|
||||
// che significa: esegui il comando ogni giorno alle 12:00
|
||||
// La sintassi di node-cron con */1 esegue il comando ogni 1 minuto
|
||||
cron.schedule('*/1 * * * *', () => {
|
||||
// console.log('Running Cron Job');
|
||||
// if (!process.env.VITE_DEBUG) {
|
||||
@@ -421,7 +429,8 @@ connectToDatabase(connectionUrl, options)
|
||||
// }
|
||||
});
|
||||
|
||||
// Cron every X minutes
|
||||
|
||||
// Cron every 1 HOUR
|
||||
cron.schedule('*/60 * * * *', async () => {
|
||||
if (!process.env.VITE_DEBUG) {
|
||||
mycron_30min();
|
||||
|
||||
Reference in New Issue
Block a user