Changed WithRateLimiter costFunc-arg to include the methods of all calls#122
Conversation
This allows the cost func to provide a cost for the batch itself in batch requests. Some providers (Infura) include this as part of their rate limiting. Ref: https://docs.infura.io/api/networks/ethereum/how-to/make-batch-requests
|
I don't really like the convention of using the empty string method as signal for a batch request. The next special case will be a provider that charges CUs for 10+ calls in a batch requests. Maybe the more generic solution is - costFunc func(method string) (cost int)
+ costFunc func(methods []string) (cost int)What do you think? |
|
If you're ok with introducing a breaking API change, that solution makes sense to me! I didn't love using the empty string either but it seemed like the least-worst way to achieve it without breaking the The only thought I have is it leaks a little bit of the |
|
I've updated |
af4f8b4 to
f038ac1
Compare
|
Looks good 👍. Thank you for the PR. I will include this in |
WithRateLimiter costFunc-arg to include the methods of all calls
This allows the cost func to provide a cost for the batch itself in batch requests. Some providers (Infura) include this as part of their rate limiting.
Ref: https://docs.infura.io/api/networks/ethereum/how-to/make-batch-requests