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() { async tryConn() {
try { while (true)
utils.sleep(env.DB_TIMEOUT_RECONECT); try {
await checkConn(); utils.warning(new Error('Waiting for the database to respond...'));
await this.schedule(); await utils.sleep(env.DB_TIMEOUT_RECONECT);
} await checkConn();
catch (err) { await this.schedule();
throw new Error(err); }
} catch (err) {
}
} }
async schedule () { async schedule () {
@ -59,7 +60,7 @@ class Floriday {
// Continuar con todo lo que haga falta realizar en la rutina // Continuar con todo lo que haga falta realizar en la rutina
} catch (err) { } 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(){ export async function syncSuppliers(){
let spinner = ora('Preparing to load suppliers...').start(); let spinner = ora('Preparing to load suppliers...').start();
try { try {
@ -301,7 +304,7 @@ export async function syncSuppliers(){
} }
/** /**
* Sync the connections in Floriday * Create the connections in Floriday
*/ */
export async function syncConnections(){ export async function syncConnections(){
await deleteConnections(); await deleteConnections();
@ -343,6 +346,9 @@ export async function syncConnections(){
} }
} }
/**
* Sync the connections in Floriday
*/
export async function syncTradeItems(){ export async function syncTradeItems(){
const spinner = ora(`Syncing trade items...`).start(); const spinner = ora(`Syncing trade items...`).start();
const suppliers = await models.supplier.findAll({ const suppliers = await models.supplier.findAll({