mirror of
https://github.com/benjamin-wilson/public-pool.git
synced 2026-09-29 09:05:06 -07:00
fix chart, caching
This commit is contained in:
+16
-1
@@ -24,14 +24,29 @@ export class AppController {
|
|||||||
@Get('info')
|
@Get('info')
|
||||||
public async info() {
|
public async info() {
|
||||||
|
|
||||||
|
|
||||||
|
const CACHE_KEY = 'SITE_INFO';
|
||||||
|
const cachedResult = await this.cacheManager.get(CACHE_KEY);
|
||||||
|
|
||||||
|
if (cachedResult != null) {
|
||||||
|
return cachedResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const blockData = await this.blocksService.getFoundBlocks();
|
const blockData = await this.blocksService.getFoundBlocks();
|
||||||
const userAgents = await this.clientService.getUserAgents();
|
const userAgents = await this.clientService.getUserAgents();
|
||||||
|
|
||||||
return {
|
const data = {
|
||||||
blockData,
|
blockData,
|
||||||
userAgents,
|
userAgents,
|
||||||
uptime: this.uptime
|
uptime: this.uptime
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//1 min
|
||||||
|
await this.cacheManager.set(CACHE_KEY, data, 1 * 60 * 1000);
|
||||||
|
|
||||||
|
return data;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get('network')
|
@Get('network')
|
||||||
|
|||||||
Reference in New Issue
Block a user