diff --git a/floriday.js b/floriday.js index 10442aa..15fb275 100644 --- a/floriday.js +++ b/floriday.js @@ -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; } } diff --git a/utils.js b/utils.js index e367577..0917f52 100644 --- a/utils.js +++ b/utils.js @@ -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({