Replace database phone one-time password rate limiter with Redis#7554
Conversation
app/services/throttle.rb
Outdated
There was a problem hiding this comment.
There is a very slight difference in calculating the number of max attempts where Throttle uses greater than or equal to and OtpRateLimiter uses greater than
I think we'll want to rename the config and update it to not use the + 1 once we've switched over.
zachmargolis
left a comment
There was a problem hiding this comment.
LGTM. Since the limits for these are relatively low, we don't need to worry about like a transition/rollover case right? we'll just give everybody a quick rate limit reset at deploy time?
I think the risk is relatively low, but opted to include the |
07aa424 to
cd4dfaa
Compare
085aff3 to
57d3452
Compare
changelog: Internal, Rate Limiting, Replace database phone one-time password rate limiter with Redis
Co-authored-by: Zach Margolis <zachmargolis@users.noreply.github.com>
57d3452 to
f6028b3
Compare
| class Throttle | ||
| attr_reader :throttle_type | ||
|
|
||
| THROTTLE_CONFIG = { |
There was a problem hiding this comment.
Curious: What's the reason/context for refactoring this constant?
There was a problem hiding this comment.
I think I was having trouble with the tests and having multiple avenues to stub since it can be accessed through the constant and the Throttle.attempt_window_in_minutes/1 method. It was a change I'd been considering for a bit and I swear there was a good reason to bring it into this PR in particular, but I'm struggling to remember the specifics 😓
Definitely open to improvements/reversion.
changelog: Internal, Rate Limiting, Replace database phone one-time password rate limiter with Redis