diff --git a/src/ORM/client-statistics/client-statistics.service.ts b/src/ORM/client-statistics/client-statistics.service.ts index 748f68d..de288d7 100644 --- a/src/ORM/client-statistics/client-statistics.service.ts +++ b/src/ORM/client-statistics/client-statistics.service.ts @@ -48,6 +48,8 @@ export class ClientStatisticsService { var yesterday = new Date(new Date().getTime() - (24 * 60 * 60 * 1000)); const query = ` + SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; + SELECT time AS label, ROUND(((SUM(shares) * 4294967296) / 600)) AS data diff --git a/src/app.controller.ts b/src/app.controller.ts index ff3eb5f..8c6e592 100644 --- a/src/app.controller.ts +++ b/src/app.controller.ts @@ -44,17 +44,17 @@ export class AppController { public async infoChart() { - // const CACHE_KEY = 'SITE_HASHRATE_GRAPH'; - // const cachedResult = await this.cacheManager.get(CACHE_KEY); + const CACHE_KEY = 'SITE_HASHRATE_GRAPH'; + const cachedResult = await this.cacheManager.get(CACHE_KEY); - // if (cachedResult != null) { - // return cachedResult; - // } + if (cachedResult != null) { + return cachedResult; + } const chartData = await this.clientStatisticsService.getChartDataForSite(); - //5 min - //await this.cacheManager.set(CACHE_KEY, chartData, 5 * 60 * 1000); + //10 min + await this.cacheManager.set(CACHE_KEY, chartData, 10 * 60 * 1000); return chartData;