fix possible backend crash x2, remove dead code, improve log
This commit is contained in:
@@ -472,11 +472,11 @@ class Mining {
|
||||
}
|
||||
this.blocksPriceIndexingRunning = true;
|
||||
|
||||
let totalInserted = 0;
|
||||
try {
|
||||
const prices: any[] = await PricesRepository.$getPricesTimesAndId();
|
||||
const blocksWithoutPrices: any[] = await BlocksRepository.$getBlocksWithoutPrice();
|
||||
|
||||
let totalInserted = 0;
|
||||
const blocksPrices: BlockPrice[] = [];
|
||||
|
||||
for (const block of blocksWithoutPrices) {
|
||||
@@ -521,7 +521,13 @@ class Mining {
|
||||
}
|
||||
} catch (e) {
|
||||
this.blocksPriceIndexingRunning = false;
|
||||
throw e;
|
||||
logger.err(`Cannot index block prices. ${e}`);
|
||||
}
|
||||
|
||||
if (totalInserted > 0) {
|
||||
logger.info(`Indexing blocks prices completed. Indexed ${totalInserted}`, logger.tags.mining);
|
||||
} else {
|
||||
logger.debug(`Indexing blocks prices completed. Indexed 0.`, logger.tags.mining);
|
||||
}
|
||||
|
||||
this.blocksPriceIndexingRunning = false;
|
||||
|
||||
Reference in New Issue
Block a user