Relay failures through command line interface (#1700)

* Relay failures through command line interface
This commit is contained in:
F. Eugene Aumson
2019-03-15 10:38:21 -04:00
committed by GitHub
parent 70e550a25f
commit 7f5a3f12ca

View File

@@ -31,6 +31,7 @@ let connection: Connection;
connection = await createConnection(ormConfig as ConnectionOptions);
const edpsSource = new EdpsSource(EDPS_MAX_REQUESTS_PER_SECOND);
const cryptoCompareSource = new CryptoCompareOHLCVSource(CRYPTO_COMPARE_MAX_REQS_PER_SECOND);
let hasFailed: boolean = false;
logUtils.log('Fetching slippage records');
const nestedSlippages: Slippage[][][] = await Promise.all(
@@ -49,6 +50,7 @@ let connection: Connection;
} catch (e) {
logUtils.log(`Error getting data for symbol=${symbol}, amount=${amount}`);
logUtils.log(e);
hasFailed = true;
return [new Slippage()];
}
}),
@@ -63,5 +65,5 @@ let connection: Connection;
logUtils.log(`Saving ${slippages.length} records to database`);
await SlippageRepository.save(slippages, { chunk: Math.ceil(slippages.length / BATCH_SAVE_SIZE) });
logUtils.log('Done');
process.exit(0);
process.exit(hasFailed ? 1 : 0);
})().catch(handleError);