module Mosquito::RateLimiter
Defined in:
mosquito/rate_limiter.crInstance Method Summary
-
#increment_run_count : Nil
Increments the run counter.
-
#increment_run_count_by : Int32
How much the run counter should be incremented by.
-
#maxed_rate_for_window? : Bool
Has the run count exceeded the ceiling for the current window?
-
#metadata : Metadata
Storage hash for rate limit data.
-
#rate_limited? : Bool
Should this job be cancelled? If not, update the rate limit metadata.
-
#reschedule_interval(retry_count : Int32) : Time::Span
Configure the reschedule interval so that the job_run is not run again until it should be allowed through the rate limiter.
-
#rescheduleable?(retry_count : Int32) : Bool
Configure the rescheduler to always retry if a job is rate limited.
-
#update_window_start : Nil
Resets the run count and logs the start of window.
-
#window_expires_at : Time | Nil
When does the current rate limit window expire? Returns nil if the window is already expired.
-
#window_start : Time | Nil
Calculates the start of the rate limit window.
Instance Method Detail
How much the run counter should be incremented by. Implemented as a dynamic method so that it can easily be calculated by some other metric, eg api calls to a third party library.
Configure the reschedule interval so that the job_run is not run again until it should be allowed through the rate limiter.
Configure the rescheduler to always retry if a job is rate limited.
When does the current rate limit window expire? Returns nil if the window is already expired.