mirror of
https://gitlab.com/famedly/conduit.git
synced 2025-07-27 17:28:36 +00:00
simplify
This commit is contained in:
parent
bf902f1607
commit
ab21c5dbef
5 changed files with 28 additions and 101 deletions
|
@ -117,6 +117,8 @@ pub enum Restriction {
|
|||
|
||||
#[derive(Deserialize, Clone, Copy, Debug)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
// When deserializing, we want this prefix
|
||||
#[allow(clippy::enum_variant_names)]
|
||||
pub enum Timeframe {
|
||||
PerSecond(NonZeroU64),
|
||||
PerMinute(NonZeroU64),
|
||||
|
@ -141,8 +143,6 @@ pub struct Limitation {
|
|||
pub timeframe: Timeframe,
|
||||
#[serde(default = "default_non_zero")]
|
||||
pub burst_capacity: NonZeroU64,
|
||||
#[serde(default = "default_non_zero")]
|
||||
pub weight: NonZeroU64,
|
||||
}
|
||||
|
||||
const DEPRECATED_KEYS: &[&str] = &["cache_capacity"];
|
||||
|
@ -362,7 +362,6 @@ pub fn default_rate_limit() -> BTreeMap<Restriction, Limitation> {
|
|||
Limitation {
|
||||
timeframe: Timeframe::PerMinute(NonZeroU64::MIN),
|
||||
burst_capacity: NonZeroU64::MIN,
|
||||
weight: NonZeroU64::MIN,
|
||||
},
|
||||
)])
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue