mirror of
https://github.com/benjamin-wilson/public-pool.git
synced 2026-09-29 17:15:03 -07:00
data rework
This commit is contained in:
+20
-16
@@ -21,26 +21,30 @@ export class AppController {
|
||||
const blockData = await this.blocksService.getFoundBlocks();
|
||||
const userAgents = await this.clientService.getUserAgents();
|
||||
|
||||
const CACHE_KEY = 'SITE_HASHRATE_GRAPH';
|
||||
const cachedResult = await this.cacheManager.get(CACHE_KEY);
|
||||
if (cachedResult != null) {
|
||||
return {
|
||||
chartData: cachedResult,
|
||||
blockData,
|
||||
userAgents
|
||||
};
|
||||
}
|
||||
|
||||
const chartData = [];// await this.clientStatisticsService.getChartDataForSite();
|
||||
|
||||
//5 min
|
||||
await this.cacheManager.set(CACHE_KEY, chartData, 5 * 60 * 1000);
|
||||
|
||||
return {
|
||||
chartData,
|
||||
blockData,
|
||||
userAgents
|
||||
};
|
||||
}
|
||||
@Get('info/chart')
|
||||
public async infoChart() {
|
||||
|
||||
|
||||
// const CACHE_KEY = 'SITE_HASHRATE_GRAPH';
|
||||
// const cachedResult = await this.cacheManager.get(CACHE_KEY);
|
||||
|
||||
// if (cachedResult != null) {
|
||||
// return cachedResult;
|
||||
// }
|
||||
|
||||
const chartData = await this.clientStatisticsService.getChartDataForSite();
|
||||
|
||||
//5 min
|
||||
//await this.cacheManager.set(CACHE_KEY, chartData, 5 * 60 * 1000);
|
||||
|
||||
return chartData;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user