refs #4823 Minor changes

This commit is contained in:
Guillermo Bonet 2023-05-22 07:54:45 +02:00
parent 06d536f0b0
commit 0d8fde61bd
1 changed files with 7 additions and 5 deletions

View File

@ -36,8 +36,7 @@ class Floriday {
const intervalTime = JSON.parse(env.IS_PRODUCTION)
? env.MS_PRODUCTION_SCHEDULE
: env.MS_TEST_SCHEDULE;
this.continueSchedule = true;
while (this.continueSchedule) {
while (!this.stopSchedule) {
try {
await this.trunk();
await new Promise(resolve => setTimeout(resolve, intervalTime));
@ -53,10 +52,13 @@ class Floriday {
async trunk() {
try{
if (JSON.parse(env.SYNC_CON)) await utils.syncConnections();
// ------------------------
await utils.syncOrganizations();
await utils.syncConnections();
await utils.syncSupplyLines();
// Continuar con todo lo que haga falta realizar en la rutina
// ------------------------
} catch (err) {
if (err.name === 'SequelizeConnectionRefusedError') throw err;
@ -65,7 +67,7 @@ class Floriday {
}
async stop() {
this.continueSchedule = false;
this.stopSchedule = false;
await closeCon();
console.warn(chalk.dim('Bye, come back soon 👋'))
}