Skip to content
New issue

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

add DAC requests a rate limit and if error avoid requests for a period of time #96

Merged
merged 6 commits into from
Aug 20, 2024

Conversation

joanestebanr
Copy link
Contributor

@joanestebanr joanestebanr commented Aug 19, 2024

Closes #95

Rationale

If a DAC Server is returing error, avoid to do request for a while

Implementation

You can configure the cool down period if error. It's not going to do new requests until RetryOnDACErrorInterval reach:

[Etherman.Validium]
		RetryOnDACErrorInterval = "5m"

Add a rate limit:

[Etherman.Validium.RateLimit]
			NumRequests = 900
			Interval = "1s"

To disable it set NumRequests to 0
It allows to do NumRequests in the interval Interval if try to do more requests it sleeps until fulfill the rate

@joanestebanr joanestebanr requested a review from ARR552 as a code owner August 19, 2024 13:17
@cla-bot cla-bot bot added the cla-signed label Aug 19, 2024
@joanestebanr joanestebanr self-assigned this Aug 19, 2024
@joanestebanr joanestebanr merged commit 7ca6a32 into develop Aug 20, 2024
14 checks passed
@joanestebanr joanestebanr deleted the feature/95-dac_ratelimit branch August 20, 2024 07:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Avoid do requests for a while to DAC Server if have returned an error and add a rate limit
2 participants