mirror of
https://github.com/mempool/mempool.git
synced 2025-02-23 22:46:54 +01:00
Set expiration to 1 min for /mining/reward-stats/:blockCount and /blocks-extras/:height
This commit is contained in:
parent
ae13f6119e
commit
a58d5b84b6
1 changed files with 2 additions and 0 deletions
|
@ -723,6 +723,7 @@ class Routes {
|
|||
public async getBlocksExtras(req: Request, res: Response) {
|
||||
try {
|
||||
const height = req.params.height === undefined ? undefined : parseInt(req.params.height, 10);
|
||||
res.setHeader('Expires', new Date(Date.now() + 1000 * 60).toUTCString());
|
||||
res.json(await blocks.$getBlocksExtras(height, 15));
|
||||
} catch (e) {
|
||||
res.status(500).send(e instanceof Error ? e.message : e);
|
||||
|
@ -1002,6 +1003,7 @@ class Routes {
|
|||
public async $getRewardStats(req: Request, res: Response) {
|
||||
try {
|
||||
const response = await mining.$getRewardStats(parseInt(req.params.blockCount, 10));
|
||||
res.setHeader('Expires', new Date(Date.now() + 1000 * 60).toUTCString());
|
||||
res.json(response);
|
||||
} catch (e) {
|
||||
res.status(500).end();
|
||||
|
|
Loading…
Add table
Reference in a new issue