Add cache for get blocks by number#927
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| return handleError[*ethTypes.Block](err, l, b.collector) | ||
| } | ||
|
|
||
| _ = b.blockByNumberCache.Add(height, apiBlock) |
There was a problem hiding this comment.
Given that GetBlockByHash, does pretty much the exact same DB calls, we could possibly improve that one too.
There was a problem hiding this comment.
yea. now that we're not in a rush to get something out, I think we should take a more wholistic approach to caching based on our findings from the load test
This PR adds a simple cache for the response from
GetBlockByNumber, which can be heavy when there are a lot of tx in a block