refs #4823 Now supports db drops
This commit is contained in:
parent
d3f9216f36
commit
a6da4feb1f
19
floriday.js
19
floriday.js
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
8
utils.js
8
utils.js
|
@ -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({
|
||||||
|
|
Loading…
Reference in New Issue