refs #4823 Minor changes
This commit is contained in:
parent
06d536f0b0
commit
0d8fde61bd
12
floriday.js
12
floriday.js
|
@ -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 👋'))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue