Skip to main content

Module graphql_rate_limit

Module graphql_rate_limit 

Source
Expand description

Sliding-window request-count rate limiter for GraphQL API targets.

Limits outgoing requests to max_requests in any rolling window duration. Before each request rate_limit_acquire is called; it records the current timestamp and sleeps until the oldest in-window request expires if the window is already full.

A server-returned Retry-After value can be applied via rate_limit_retry_after, which imposes a hard block until the indicated instant irrespective of the sliding window state.

Operates in parallel with graphql_throttle (leaky-bucket cost throttle). Both can be active simultaneously.

Re-exports§

pub use crate::ports::graphql_plugin::RateLimitConfig;

Structs§

RequestRateLimit
Shareable, cheaply-cloneable handle to a per-plugin sliding-window limiter.

Functions§

parse_retry_after
Parse an integer Retry-After value from a header string.
rate_limit_acquire
Sleep until a request slot is available within the rolling window, then record the slot.
rate_limit_retry_after
Record a server-returned Retry-After delay.