From eceedf0bdfa6fd806596d2f707bc3f437de94c9d Mon Sep 17 00:00:00 2001 From: nymkappa <1612910616@pm.me> Date: Sun, 19 Feb 2023 19:17:51 +0900 Subject: [PATCH] Dont compute fee percentile / median fee when indexing is disabled because we need summaries --- backend/src/api/blocks.ts | 8 +++++--- backend/src/database.ts | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/backend/src/api/blocks.ts b/backend/src/api/blocks.ts index 25c199de9..8a11bccc5 100644 --- a/backend/src/api/blocks.ts +++ b/backend/src/api/blocks.ts @@ -207,9 +207,11 @@ class Blocks { blk.extras.blockTime = 0; // TODO - blk.extras.feePercentiles = await BlocksSummariesRepository.$getFeePercentilesByBlockId(block.id); - if (blk.extras.feePercentiles !== null) { - blk.extras.medianFeeAmt = blk.extras.feePercentiles[3]; + if (Common.indexingEnabled()) { + blk.extras.feePercentiles = await BlocksSummariesRepository.$getFeePercentilesByBlockId(block.id); + if (blk.extras.feePercentiles !== null) { + blk.extras.medianFeeAmt = blk.extras.feePercentiles[3]; + } } blk.extras.virtualSize = block.weight / 4.0; diff --git a/backend/src/database.ts b/backend/src/database.ts index c2fb0980b..a504eb0fa 100644 --- a/backend/src/database.ts +++ b/backend/src/database.ts @@ -24,7 +24,8 @@ import { FieldPacket, OkPacket, PoolOptions, ResultSetHeader, RowDataPacket } fr private checkDBFlag() { if (config.DATABASE.ENABLED === false) { - logger.err('Trying to use DB feature but config.DATABASE.ENABLED is set to false, please open an issue'); + const stack = new Error().stack; + logger.err(`Trying to use DB feature but config.DATABASE.ENABLED is set to false, please open an issue.\nStack trace: ${stack}}`); } }