Rate limits warning (#4075)
Only show the highest warning rate. Change the warning threshold
This commit is contained in:
@@ -392,33 +392,22 @@ fn rate_limit_warnings_emit_thresholds() {
|
||||
warnings.extend(state.take_warnings(95.0, 10.0));
|
||||
|
||||
assert_eq!(
|
||||
warnings.len(),
|
||||
6,
|
||||
"expected one warning per threshold per limit"
|
||||
);
|
||||
assert!(
|
||||
warnings
|
||||
.iter()
|
||||
.any(|w| w.contains("Heads up, you've used over 50% of your 5h limit.")),
|
||||
"expected hourly 50% warning (new copy)"
|
||||
);
|
||||
assert!(
|
||||
warnings
|
||||
.iter()
|
||||
.any(|w| w.contains("Heads up, you've used over 50% of your weekly limit.")),
|
||||
"expected weekly 50% warning (new copy)"
|
||||
);
|
||||
assert!(
|
||||
warnings
|
||||
.iter()
|
||||
.any(|w| w.contains("Heads up, you've used over 90% of your 5h limit.")),
|
||||
"expected hourly 90% warning (new copy)"
|
||||
);
|
||||
assert!(
|
||||
warnings
|
||||
.iter()
|
||||
.any(|w| w.contains("Heads up, you've used over 90% of your weekly limit.")),
|
||||
"expected weekly 90% warning (new copy)"
|
||||
warnings,
|
||||
vec![
|
||||
String::from(
|
||||
"Heads up, you've used over 75% of your 5h limit. Run /status for a breakdown."
|
||||
),
|
||||
String::from(
|
||||
"Heads up, you've used over 75% of your weekly limit. Run /status for a breakdown.",
|
||||
),
|
||||
String::from(
|
||||
"Heads up, you've used over 95% of your 5h limit. Run /status for a breakdown."
|
||||
),
|
||||
String::from(
|
||||
"Heads up, you've used over 95% of your weekly limit. Run /status for a breakdown.",
|
||||
),
|
||||
],
|
||||
"expected one warning per limit for the highest crossed threshold"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user