Spaces:
Runtime error
Runtime error
alamin655
commited on
Commit
•
0132a63
1
Parent(s):
3c1aaf6
Apply suggestions from code review
Browse files- src/config/parser_models.rs +1 -1
- src/lib.rs +2 -2
src/config/parser_models.rs
CHANGED
@@ -48,7 +48,7 @@ pub struct AggregatorConfig {
|
|
48 |
pub random_delay: bool,
|
49 |
}
|
50 |
|
51 |
-
/// Configuration options for the rate
|
52 |
///
|
53 |
/// # Fields
|
54 |
///
|
|
|
48 |
pub random_delay: bool,
|
49 |
}
|
50 |
|
51 |
+
/// Configuration options for the rate limiter middleware.
|
52 |
///
|
53 |
/// # Fields
|
54 |
///
|
src/lib.rs
CHANGED
@@ -71,8 +71,8 @@ pub fn run(listener: TcpListener, config: Config) -> std::io::Result<Server> {
|
|
71 |
.wrap(cors)
|
72 |
.wrap(Governor::new(
|
73 |
&GovernorConfigBuilder::default()
|
74 |
-
.per_second(config.
|
75 |
-
.burst_size(config.
|
76 |
.finish()
|
77 |
.unwrap(),
|
78 |
))
|
|
|
71 |
.wrap(cors)
|
72 |
.wrap(Governor::new(
|
73 |
&GovernorConfigBuilder::default()
|
74 |
+
.per_second(config.rate_limiter.time_limit as u64)
|
75 |
+
.burst_size(config.rate_limiter.number_of_requests as u32)
|
76 |
.finish()
|
77 |
.unwrap(),
|
78 |
))
|