refs #4823 Now supports db drops

This commit is contained in:
Guillermo Bonet 2023-05-17 07:36:58 +02:00
parent d3f9216f36
commit a6da4feb1f
2 changed files with 17 additions and 10 deletions

View File

@ -22,14 +22,15 @@ class Floriday {
}
async tryConn() {
try {
utils.sleep(env.DB_TIMEOUT_RECONECT);
await checkConn();
await this.schedule();
}
catch (err) {
throw new Error(err);
}
while (true)
try {
utils.warning(new Error('Waiting for the database to respond...'));
await utils.sleep(env.DB_TIMEOUT_RECONECT);
await checkConn();
await this.schedule();
}
catch (err) {
}
}
async schedule () {
@ -59,7 +60,7 @@ class Floriday {
// Continuar con todo lo que haga falta realizar en la rutina
} catch (err) {
utils.criticalError(err);
throw err;
}
}

View File

@ -253,6 +253,9 @@ export async function syncSequence(current = 0, model = null , maximumSequenceNu
}
}
/**
* Sync the suppliers
*/
export async function syncSuppliers(){
let spinner = ora('Preparing to load suppliers...').start();
try {
@ -301,7 +304,7 @@ export async function syncSuppliers(){
}
/**
* Sync the connections in Floriday
* Create the connections in Floriday
*/
export async function syncConnections(){
await deleteConnections();
@ -343,6 +346,9 @@ export async function syncConnections(){
}
}
/**
* Sync the connections in Floriday
*/
export async function syncTradeItems(){
const spinner = ora(`Syncing trade items...`).start();
const suppliers = await models.supplier.findAll({