pub struct RateLimitPolicy {
pub max_in_flight: u32,
pub max_enqueue_per_second: u32,
}Expand description
Rate limiting for enqueue backpressure.
max_in_flight == 0 and max_enqueue_per_second == 0 mean unlimited (default).
When a limit is exceeded, Boson::enqueue returns
BosonError::RateLimited; callers should retry with backoff.
§Example
use boson_core::RateLimitPolicy;
// At most 10 active jobs and 5 enqueues per second for one task.
let policy = RateLimitPolicy {
max_in_flight: 10,
max_enqueue_per_second: 5,
};Fields§
§max_in_flight: u32Max jobs for this task in queued + running at once. 0 = no limit.
max_enqueue_per_second: u32Max successful enqueues per wall-clock second per process. 0 = no limit.
Trait Implementations§
Source§impl Clone for RateLimitPolicy
impl Clone for RateLimitPolicy
Source§fn clone(&self) -> RateLimitPolicy
fn clone(&self) -> RateLimitPolicy
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for RateLimitPolicy
Source§impl Debug for RateLimitPolicy
impl Debug for RateLimitPolicy
Source§impl Default for RateLimitPolicy
impl Default for RateLimitPolicy
Source§fn default() -> RateLimitPolicy
fn default() -> RateLimitPolicy
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for RateLimitPolicy
impl<'de> Deserialize<'de> for RateLimitPolicy
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for RateLimitPolicy
impl RefUnwindSafe for RateLimitPolicy
impl Send for RateLimitPolicy
impl Sync for RateLimitPolicy
impl Unpin for RateLimitPolicy
impl UnsafeUnpin for RateLimitPolicy
impl UnwindSafe for RateLimitPolicy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more