You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I plan to implement a behavior that prevents getting into the rate limit. I think it can be added to the gem as an opt-in
something like this
Monobank::Methods::Base will wrap its calls into MonoBank.rate_limiter.call passing the token and the endpoint
the developer supplies the rate limiter which can track the token/endpoint combination the way it wants (redis/memory/etc)
example
classMyRateLimiterdefinitialize(redis:)@redis=redisenddefcall(token:,endpoint:)if@redis.exists?("#{token}:#{endpoint}")raiseStandardError.new# or whatever else the developer wantsendbeginyield# back to the calling methodensure@redis.set("#{token}:#{endpoint}",'',ex: 60)endendendMonobank.configure(rate_limiter: MyRateLimiter.new(redis: $redis)
The text was updated successfully, but these errors were encountered:
I plan to implement a behavior that prevents getting into the rate limit. I think it can be added to the gem as an opt-in
something like this
Monobank::Methods::Base
will wrap its calls intoMonoBank.rate_limiter.call
passing the token and the endpointexample
The text was updated successfully, but these errors were encountered: