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