Skip to content

Commit 04a92bb

Browse files
committed
graph: Simplify some LoadManager constants
* Make KILL_RATE_UPDATE_INTERVAL a plain const * Remove unused WAIT_STAT_CHECK_INTERVAL
1 parent 6b4beaf commit 04a92bb

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

graph/src/data/graphql/effort.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ lazy_static! {
4343
.unwrap_or(1e9)
4444
};
4545

46-
static ref WAIT_STAT_CHECK_INTERVAL: Duration = Duration::from_secs(1);
47-
4846
// Load management can be disabled by setting the threshold to 0. This
4947
// makes sure in particular that we never take any of the locks
5048
// associated with it
@@ -396,15 +394,12 @@ impl LoadManager {
396394
// to disrupt traffic for as little as possible.
397395
const KILL_RATE_STEP_UP: f64 = 0.1;
398396
const KILL_RATE_STEP_DOWN: f64 = 2.0 * KILL_RATE_STEP_UP;
399-
400-
lazy_static! {
401-
static ref KILL_RATE_UPDATE_INTERVAL: Duration = Duration::from_millis(1000);
402-
}
397+
const KILL_RATE_UPDATE_INTERVAL: Duration = Duration::from_millis(1000);
403398

404399
assert!(overloaded || kill_rate > 0.0);
405400

406401
let now = Instant::now();
407-
if now.saturating_duration_since(last_update) > *KILL_RATE_UPDATE_INTERVAL {
402+
if now.saturating_duration_since(last_update) > KILL_RATE_UPDATE_INTERVAL {
408403
// Update the kill_rate
409404
if overloaded {
410405
kill_rate = (kill_rate + KILL_RATE_STEP_UP * (1.0 - kill_rate)).min(1.0);

0 commit comments

Comments
 (0)