From f4c5a586b1bd72d4774da26b6e88083efdf22fd3 Mon Sep 17 00:00:00 2001 From: jejolare Date: Wed, 25 Sep 2024 22:38:16 +0700 Subject: [PATCH] debug --- server/server.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/server/server.ts b/server/server.ts index 89ca3d1..e8c5bfa 100644 --- a/server/server.ts +++ b/server/server.ts @@ -403,6 +403,9 @@ const requestsLimiter = rateLimit({ // const period2 = currentTime - 48 * 3600; // 48 hours ago if (chart === 'AvgBlockSize') { + + console.time('AvgBlockSize'); + const result = await Chart.findAll({ attributes: [ [ @@ -421,7 +424,11 @@ const requestsLimiter = rateLimit({ }, } }); - res.json(result.map((record) => record.toJSON())); + const json = result.map((record) => record.toJSON()); + + console.timeEnd('AvgBlockSize'); + + res.json(json); } else if (chart === 'AvgTransPerBlock') { const result = await Chart.findAll({ attributes: [ @@ -465,8 +472,11 @@ const requestsLimiter = rateLimit({ group: ['at'], order: [[literal('"at"'), 'ASC']], }); + + const json = result.map((record) => record.toJSON()); + console.timeEnd('hashRate'); - res.json(result.map((record) => record.toJSON())); + res.json(json); } else if (chart === 'pos-difficulty') { const result = await Chart.findAll({ attributes: [