We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Currently, code can address high memory usage and heavy async await.
constructor(web3) { this.web3 = typeof web3.eth != 'undefined' ? web3 : { eth: web3 }; this.isViem = web3 && 'request' in web3 && 'chain' in web3 && 'transport' in web3; this.checkedBlocks = {}; this.savedBlocks = {}; this.requests = 0; }
from above checkedBlocks and savedBlocks has no limit.
checkedBlocks
savedBlocks
async getBoundaries() { this.latestBlock = await this.getBlockWrapper('latest'); this.firstBlock = await this.getBlockWrapper(1); this.blockTime = (parseInt(this.latestBlock.timestamp, 10) - parseInt(this.firstBlock.timestamp, 10)) / (parseInt(this.latestBlock.number, 10) - 1); } // ... async getBlockWrapper(block) { if (this.savedBlocks[block]) return this.savedBlocks[block]; const { number, timestamp } = await this.web3.eth.getBlock(this.isViem ? (block == 'latest' ? { blockTag: 'latest' } : { blockNumber: block }) : block); this.savedBlocks[number] = { timestamp: Number(timestamp), number: Number(number) }; this.requests++; return this.savedBlocks[number]; }
form above the getBlockWrapper is async await it should be batched together with promise all if it's possible
getBlockWrapper
Migration and Resolution
axios
got
getBoundaries
The text was updated successfully, but these errors were encountered:
MASDXI
No branches or pull requests
Currently, code can address high memory usage and heavy async await.
from above
checkedBlocks
andsavedBlocks
has no limit.form above the
getBlockWrapper
is async await it should be batched together with promise all if it's possibleMigration and Resolution
axios
, orgot
getBoundaries
to promise all commitcheckedBlocks
andsavedBlocks
or implementing Least Recently Used (LRU)The text was updated successfully, but these errors were encountered: