-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add NanoSpeed API as first class to get the conf time on the home pag…
…e to bypass innacurate confirmation_history RPC
- Loading branch information
1 parent
b75cd87
commit 81910e7
Showing
5 changed files
with
46 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
const cron = require("node-cron"); | ||
const fetch = require("node-fetch"); | ||
const { Sentry } = require("../sentry"); | ||
const { nodeCache } = require("../client/cache"); | ||
const { NANOSPEED_STATS } = require("../constants"); | ||
|
||
const doNanoSpeedStats = async () => { | ||
try { | ||
const res = await fetch("https://api.nanospeed.info/conf-times-box-global?period=1D"); | ||
|
||
const { q90: avgConfTimep90, median } = await res.json(); | ||
|
||
nodeCache.set(NANOSPEED_STATS, { avgConfTimep90, median }); | ||
} catch (err) { | ||
Sentry.captureException(err); | ||
} | ||
}; | ||
|
||
// Every 15 smins | ||
cron.schedule("*/15 * * * *", async () => { | ||
doNanoSpeedStats(); | ||
}); | ||
|
||
doNanoSpeedStats(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters