There was a race condition where multiple frontend requests could be sent trying to retrieve the mining summary data. The first request got the data and cleared it, the second request got an empty response, then encountered an error trying to work with it.
This commit is contained in:
Dan Janosik 2022-05-12 12:21:03 -04:00
parent d30b13a15f
commit 6f2c5470e6
No known key found for this signature in database
GPG key ID: 70C0B166321C0AF8
3 changed files with 11 additions and 8 deletions

View file

@ -203,7 +203,8 @@ router.get("/get-mempool-summary", asyncHandler(async (req, res, next) => {
delete mempoolSummaryStatuses[statusId];
} else {
res.json({});
res.writeHead(204);
res.end("no summary for that id");
next();
}
@ -275,7 +276,8 @@ router.get("/get-mining-summary", asyncHandler(async (req, res, next) => {
delete miningSummaryStatuses[statusId];
} else {
res.json({});
res.writeHead(204);
res.end("no summary for that id");
next();
}

View file

@ -237,7 +237,7 @@ block endOfBody
url: `./internal-api/get-mempool-summary?statusId=${statusId}`
}).done((summaryResult) => {
if (summaryResult.count) {
if (summaryResult && summaryResult.count) {
summary = summaryResult;
$("#json-content").text(JSON.stringify(summaryResult, null, 4));

View file

@ -124,14 +124,15 @@ block endOfBody
url: `./internal-api/get-mining-summary?statusId=${statusId}`
}).done((summaryResult) => {
summary = summaryResult;
if (summaryResult && summaryResult.overall) {
summary = summaryResult;
$("#json-content").text(JSON.stringify(summary, null, 4));
$("#json-content").text(JSON.stringify(summary, null, 4));
hljs.highlightAll();
displaySummaryData(summary);
hljs.highlightAll();
displaySummaryData(summary);
}
}).always(() => {
// nothing
});