module

Mosquito::RateLimiter

Instance methods

increment_run_count

Increments the run counter.

Source
increment_run_count_by

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.

Source
maxed_rate_for_window?

Has the run count exceeded the ceiling for the current window?

Source
metadata

Storage hash for rate limit data.

Source
rate_limited?

Should this job be cancelled? If not, update the rate limit metadata.

Source
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.

Source
rescheduleable?(retry_count : Int32) : Bool

Configure the rescheduler to always retry if a job is rate limited.

Source
update_window_start

Resets the run count and logs the start of window.

Source
window_expires_at

When does the current rate limit window expire? Returns nil if the window is already expired.

Source
window_start

Calculates the start of the rate limit window.

Source

Nested types