Merge pull request #1676 from mempool/nymkappa/bugfix/duplicate-stats-call
Additional expiration header for mining pool API endpoints
This commit is contained in:
commit
f3c20d91d9
@ -723,6 +723,7 @@ class Routes {
|
|||||||
public async getBlocksExtras(req: Request, res: Response) {
|
public async getBlocksExtras(req: Request, res: Response) {
|
||||||
try {
|
try {
|
||||||
const height = req.params.height === undefined ? undefined : parseInt(req.params.height, 10);
|
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));
|
res.json(await blocks.$getBlocksExtras(height, 15));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
res.status(500).send(e instanceof Error ? e.message : e);
|
res.status(500).send(e instanceof Error ? e.message : e);
|
||||||
@ -1002,6 +1003,7 @@ class Routes {
|
|||||||
public async $getRewardStats(req: Request, res: Response) {
|
public async $getRewardStats(req: Request, res: Response) {
|
||||||
try {
|
try {
|
||||||
const response = await mining.$getRewardStats(parseInt(req.params.blockCount, 10));
|
const response = await mining.$getRewardStats(parseInt(req.params.blockCount, 10));
|
||||||
|
res.setHeader('Expires', new Date(Date.now() + 1000 * 60).toUTCString());
|
||||||
res.json(response);
|
res.json(response);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
res.status(500).end();
|
res.status(500).end();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user