pub struct ConcurrencyConfig {
pub max_concurrent_requests: usize,
pub requests_per_minute: usize,
pub enabled: bool,
pub semaphore_enabled: bool,
}Expand description
Concurrency control configuration.
This controls how LLM requests are rate-limited and throttled to avoid overwhelming the API.
Fields§
§max_concurrent_requests: usizeMaximum concurrent LLM API calls.
This limits how many requests can be in-flight at the same time. Default: 10
requests_per_minute: usizeRate limit: requests per minute.
This is a soft limit using token bucket algorithm. Default: 500 (OpenAI default tier)
enabled: boolAlias for enabled - whether rate limiting is enabled.
When disabled, only semaphore-based concurrency control is used. Default: true
semaphore_enabled: boolWhether to enable concurrency limiting via semaphore.
When disabled, only rate limiting is used. Default: true
Implementations§
Source§impl ConcurrencyConfig
impl ConcurrencyConfig
Sourcepub fn with_max_concurrent_requests(self, max: usize) -> Self
pub fn with_max_concurrent_requests(self, max: usize) -> Self
Set the maximum concurrent requests.
Sourcepub fn with_requests_per_minute(self, rpm: usize) -> Self
pub fn with_requests_per_minute(self, rpm: usize) -> Self
Set the requests per minute rate limit.
Sourcepub fn with_enabled(self, enabled: bool) -> Self
pub fn with_enabled(self, enabled: bool) -> Self
Enable or disable rate limiting.
Sourcepub fn high_throughput() -> Self
pub fn high_throughput() -> Self
Create a config for high-throughput scenarios.
Uses higher limits suitable for paid API tiers.
Sourcepub fn conservative() -> Self
pub fn conservative() -> Self
Create a config for conservative scenarios.
Uses lower limits to avoid rate limit errors.
Trait Implementations§
Source§impl Clone for ConcurrencyConfig
impl Clone for ConcurrencyConfig
Source§fn clone(&self) -> ConcurrencyConfig
fn clone(&self) -> ConcurrencyConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ConcurrencyConfig
impl Debug for ConcurrencyConfig
Source§impl Default for ConcurrencyConfig
impl Default for ConcurrencyConfig
Source§impl<'de> Deserialize<'de> for ConcurrencyConfig
impl<'de> Deserialize<'de> for ConcurrencyConfig
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>,
Source§impl From<ConcurrencyConfig> for ConcurrencyConfig
impl From<ConcurrencyConfig> for ConcurrencyConfig
Source§fn from(config: ConcurrencyConfig) -> Self
fn from(config: ConcurrencyConfig) -> Self
Auto Trait Implementations§
impl Freeze for ConcurrencyConfig
impl RefUnwindSafe for ConcurrencyConfig
impl Send for ConcurrencyConfig
impl Sync for ConcurrencyConfig
impl Unpin for ConcurrencyConfig
impl UnsafeUnpin for ConcurrencyConfig
impl UnwindSafe for ConcurrencyConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more