-
Notifications
You must be signed in to change notification settings - Fork 46
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
Optimize edge case in throttle enumerator #87
Conversation
@sambostock I see you contributed to this repo so requesting a review :) Can you 👀 this and see if this change makes sense? |
The implementation seems reasonable. Is there a test we can add or update to verify the behaviour? |
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.
👍
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.
LGTM, 👍 on @sambostock's comment.
Currently when using the throttle enumerator, even when throttled, the first value of the passed enumerator is evaluated.
This may be problematic in cases when we're throttling based on database health, as we will still perform an ActiveRecord query when throttled.
This PR updates the throttle enumerator to check the throttler before evaluating the next value.