- 
                Notifications
    You must be signed in to change notification settings 
- Fork 878
Make rate-limiting configurable #907
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
Make rate-limiting configurable #907
Conversation
| Questions for reviewers: 
 | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is on the right track. Added some cosmetic suggestions but likely to ship in the upcoming release.
Co-authored-by: Jeremy Udit <[email protected]>
Co-authored-by: Jeremy Udit <[email protected]>
Co-authored-by: Jeremy Udit <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excited to see this one land, thanks!
* Make struct type public * Scaffold functional pattern for providing writeDelay * Add WriteDelay to config and plumb it down * Add configuration for write delay * Validate writeDelay is positive * Add website description of write_delay argument * Use convenience func to pass writeDelay into rate limiter * Move convenience func closer to implementation; add convenience type * Rename write_delay --> write_delay_ms * Update github/provider.go Co-authored-by: Jeremy Udit <[email protected]> * Describe default for write_delay_ms in help text * Update github/transport.go Co-authored-by: Jeremy Udit <[email protected]> * Update website/docs/index.html.markdown Co-authored-by: Jeremy Udit <[email protected]> Co-authored-by: Jeremy Udit <[email protected]>
Fixes #845.
This PR provides a configurable delay to sleep between writes for our rate-limiting construct. Inspired by our very talented coworker Dave Cheney's "Functional options for friendly APIs" blog post. The default is the same as before, which is sleeping 1000ms between write operations.
Example terraform:
Example log output showing new sleeping times:
Example error output when a negative value is given:

Example error output when a string is given:

Example error output when a cartoonishly large number (9999999999999999999999) is given:

@kfcampbell's TODO list:
Some things that need to be addressed before making ready for review:
transport_test.gotests don't test any of the behavior with write delays