mirror of
https://github.com/benjamin-wilson/public-pool.git
synced 2026-09-29 09:05:06 -07:00
few optimizations
This commit is contained in:
@@ -48,6 +48,8 @@ export class ClientStatisticsService {
|
|||||||
var yesterday = new Date(new Date().getTime() - (24 * 60 * 60 * 1000));
|
var yesterday = new Date(new Date().getTime() - (24 * 60 * 60 * 1000));
|
||||||
|
|
||||||
const query = `
|
const query = `
|
||||||
|
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
time AS label,
|
time AS label,
|
||||||
ROUND(((SUM(shares) * 4294967296) / 600)) AS data
|
ROUND(((SUM(shares) * 4294967296) / 600)) AS data
|
||||||
|
|||||||
@@ -44,17 +44,17 @@ export class AppController {
|
|||||||
public async infoChart() {
|
public async infoChart() {
|
||||||
|
|
||||||
|
|
||||||
// const CACHE_KEY = 'SITE_HASHRATE_GRAPH';
|
const CACHE_KEY = 'SITE_HASHRATE_GRAPH';
|
||||||
// const cachedResult = await this.cacheManager.get(CACHE_KEY);
|
const cachedResult = await this.cacheManager.get(CACHE_KEY);
|
||||||
|
|
||||||
// if (cachedResult != null) {
|
if (cachedResult != null) {
|
||||||
// return cachedResult;
|
return cachedResult;
|
||||||
// }
|
}
|
||||||
|
|
||||||
const chartData = await this.clientStatisticsService.getChartDataForSite();
|
const chartData = await this.clientStatisticsService.getChartDataForSite();
|
||||||
|
|
||||||
//5 min
|
//10 min
|
||||||
//await this.cacheManager.set(CACHE_KEY, chartData, 5 * 60 * 1000);
|
await this.cacheManager.set(CACHE_KEY, chartData, 10 * 60 * 1000);
|
||||||
|
|
||||||
return chartData;
|
return chartData;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user