diff --git a/crates/kumo-api-types/src/shaping.rs b/crates/kumo-api-types/src/shaping.rs index 8cbc8b19..64daff4f 100644 --- a/crates/kumo-api-types/src/shaping.rs +++ b/crates/kumo-api-types/src/shaping.rs @@ -27,6 +27,8 @@ use std::marker::PhantomData; #[cfg(feature = "lua")] use std::sync::Arc; use std::time::Duration; +#[cfg(feature = "lua")] +use throttle::LimitSpec; use throttle::ThrottleSpec; #[derive(Deserialize, Serialize, Debug, Clone)] @@ -1011,7 +1013,7 @@ pub struct ProviderEntry { pub provider_name: String, #[serde(default)] - pub provider_connection_limit: Option, + pub provider_connection_limit: Option, #[serde(default)] pub provider_max_message_rate: Option, @@ -1197,7 +1199,7 @@ impl ProviderEntry { let mut limits = toml::Table::new(); limits.insert( format!("shaping-provider-{}-{source}-limit", self.provider_name), - toml::Value::Integer((*limit) as i64), + toml::Value::String(limit.to_string()), ); implied.insert( "additional_connection_limits".to_string(), diff --git a/crates/throttle/src/lib.rs b/crates/throttle/src/lib.rs index 375b410d..aeac23c7 100644 --- a/crates/throttle/src/lib.rs +++ b/crates/throttle/src/lib.rs @@ -246,6 +246,12 @@ impl std::fmt::Debug for LimitSpec { } } +impl std::fmt::Display for LimitSpec { + fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result { + write!(fmt, "{:?}", self) + } +} + impl LimitSpec { pub const fn new(limit: u64) -> Self { Self {