Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

Add new ENABLE_ETHEREUM_RPC_RATE_LIMITING environment variable #584

Merged
merged 3 commits into from
Dec 12, 2019

Conversation

albrow
Copy link
Contributor

@albrow albrow commented Dec 12, 2019

This new environment variable will allow users to completely disable Ethereum RPC rate limiting. Disabling the feature does come with some risks and can lead to abnormally high bills for services like Infura and Alchemy depending on network conditions. Still, some users, and in particular market makers, might prefer higher costs to the alternative of not receiving order updates quickly.

return nil, err
var ethRPCRateLimiter ratelimit.RateLimiter
if config.EnableEthereumRPCRateLimiting == false {
ethRPCRateLimiter = ratelimit.NewUnlimited()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fabioberger I opted to re-use the existing fakeLimiter type and just renamed the constructor from NewFakeLimiter to NewUnlimited. This way we can still count and log the number of RPC requests that were allowed. It also required the fewest code changes. Let me know if there would be any issues with this approach.

browser/ts/index.ts Outdated Show resolved Hide resolved
@albrow albrow merged commit 1c75a39 into development Dec 12, 2019
@albrow albrow deleted the feature/env-var-enable-ethereum-rpc-rate-limiting branch December 12, 2019 01:31
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants