mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 16:57:49 +03:00
Change type of timeout from usize to std::time::Duration
Summary: Proper duration types can help catch more bugs at compile time than passing around usize. This moves the Rust Configerator client's timeout argument from usize to a proper duration type. Reviewed By: dtolnay Differential Revision: D16854216 fbshipit-source-id: a067c13a56a1dc8e5bad5c9f6243774fd9e0b462
This commit is contained in:
parent
b778fd2482
commit
06d4486292
@ -6,7 +6,7 @@
|
||||
|
||||
use std::mem;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use std::time::Instant;
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
use crate::failure::{prelude::*, SlogKVError};
|
||||
use configerator::ConfigeratorAPI;
|
||||
@ -46,7 +46,7 @@ lazy_static! {
|
||||
|
||||
// It's made public so that the code that creates ConfigeratorAPI can subscribe to this category
|
||||
pub const CONFIGERATOR_LIMITS_CONFIG: &str = "scm/mononoke/loadshedding/limits";
|
||||
const CONFIGERATOR_TIMEOUT_MS: usize = 25;
|
||||
const CONFIGERATOR_TIMEOUT: Duration = Duration::from_millis(25);
|
||||
const DEFAULT_PERCENTAGE: f64 = 100.0;
|
||||
|
||||
define_stats! {
|
||||
@ -213,7 +213,7 @@ fn loadlimiting_configs(
|
||||
client_hostname: String,
|
||||
) -> Option<MononokeThrottleLimit> {
|
||||
let data = configerator_api
|
||||
.get_entity(CONFIGERATOR_LIMITS_CONFIG, CONFIGERATOR_TIMEOUT_MS)
|
||||
.get_entity(CONFIGERATOR_LIMITS_CONFIG, CONFIGERATOR_TIMEOUT)
|
||||
.ok();
|
||||
data.and_then(|data| {
|
||||
let config: Option<MononokeThrottleLimits> = serde_json::from_str(&data.contents).ok();
|
||||
|
Loading…
Reference in New Issue
Block a user