Skip to content

Commit 5c8f250

Browse files
edward-shenmeta-codesync[bot]
authored andcommitted
Replace Duration::from_secs(60) to Duration::from_mins(1)
Summary: X-link: meta-pytorch/torchft#297 X-link: meta-pytorch/monarch#2066 Rust 1.91 introduced `Duration::from_mins`. This diff replaces some instances of `Duration::from_secs` with the corresponding `Duration::from_mins`. Reviewed By: dtolnay Differential Revision: D88434166 fbshipit-source-id: e5e86763e0f4cfa6da502d32f1f98ffc198399ed
1 parent b4b61cf commit 5c8f250

File tree

18 files changed

+35
-35
lines changed

18 files changed

+35
-35
lines changed

common/rust/shed/stats/src/macros.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ pub mod common_macro_prelude {
6363
/// dtest_t: dynamic_timeseries("test_t.{}", (region: &'static str); Rate, Sum),
6464
/// dtest_t2: dynamic_timeseries("test_t.two.{}.{}", (job: u64, region: &'static str); Count),
6565
/// dtest_h: dynamic_histogram("test_h.{}", (region: &'static str); 1, 0, 1000, Sum; P 99),
66-
/// test_qs: quantile_stat("test_qs"; Count, Sum, Average; P 95, P 99; Duration::from_secs(60)),
67-
/// test_qs_two: quantile_stat(Count, Sum, Average; P 95; Duration::from_secs(60)),
68-
/// test_dynqs: dynamic_quantile_stat("test_dynqs_{}", (num: i32); Count, Sum, Average; P 95, P 99; Duration::from_secs(60)),
66+
/// test_qs: quantile_stat("test_qs"; Count, Sum, Average; P 95, P 99; Duration::from_mins(1)),
67+
/// test_qs_two: quantile_stat(Count, Sum, Average; P 95; Duration::from_mins(1)),
68+
/// test_dynqs: dynamic_quantile_stat("test_dynqs_{}", (num: i32); Count, Sum, Average; P 95, P 99; Duration::from_mins(1)),
6969
/// }
7070
///
7171
/// #[allow(non_snake_case)]

eden/mononoke/benchmarks/derived_data/benchmark_estimate_similarity.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pub const MB: usize = KB * 1024;
2626
#[fbinit::main]
2727
fn main(_fb: FacebookInit) -> Result<(), Error> {
2828
let mut c = Criterion::default()
29-
.measurement_time(Duration::from_secs(60))
29+
.measurement_time(Duration::from_mins(1))
3030
.sample_size(10);
3131

3232
let mut group = c.benchmark_group("estimate_similarity");

eden/mononoke/benchmarks/storage_config/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ fn main(fb: fbinit::FacebookInit) -> Result<(), Error> {
5858
let args: BenchmarkArgs = app.args()?;
5959

6060
let mut criterion = Criterion::default()
61-
.measurement_time(Duration::from_secs(60))
61+
.measurement_time(Duration::from_mins(1))
6262
.sample_size(10)
63-
.warm_up_time(Duration::from_secs(60));
63+
.warm_up_time(Duration::from_mins(1));
6464

6565
if let Some(baseline) = &args.save_baseline {
6666
criterion = criterion.save_baseline(baseline.to_string());

eden/mononoke/blobstore/ephemeral_blobstore/src/store.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1812,7 +1812,7 @@ mod test {
18121812
// Tests for lifetime extension logic
18131813
#[mononoke::fbinit_test]
18141814
async fn extend_bubble_ttl_with_longer_duration_test(fb: FacebookInit) -> Result<()> {
1815-
let initial = Duration::from_secs(60); // 1 minute initial lifespan
1815+
let initial = Duration::from_mins(1); // 1 minute initial lifespan
18161816
let grace = Duration::from_secs(30);
18171817
let (ctx, _, _, eph) = bootstrap(fb, initial, grace, BubbleDeletionMode::MarkAndDelete)?;
18181818

@@ -1904,7 +1904,7 @@ mod test {
19041904

19051905
#[mononoke::fbinit_test]
19061906
async fn extend_bubble_ttl_without_duration_test(fb: FacebookInit) -> Result<()> {
1907-
let initial = Duration::from_secs(60); // 1 minute initial lifespan
1907+
let initial = Duration::from_mins(1); // 1 minute initial lifespan
19081908
let grace = Duration::from_secs(30);
19091909
let (ctx, _, _, eph) = bootstrap(fb, initial, grace, BubbleDeletionMode::MarkAndDelete)?;
19101910

@@ -1923,7 +1923,7 @@ mod test {
19231923
ExtendBubbleTtlOutcome::Extended(timestamp) => {
19241924
// The new expiration should be approximately 1 minute from now (default lifetime)
19251925
let now = DateTime::now();
1926-
let expected_expiry = now + to_chrono(Duration::from_secs(60));
1926+
let expected_expiry = now + to_chrono(Duration::from_mins(1));
19271927
let actual_expiry: DateTime = timestamp.into();
19281928

19291929
// Allow for some time difference due to test execution time
@@ -1963,7 +1963,7 @@ mod test {
19631963

19641964
// Try to extend TTL of the expired bubble
19651965
let result = eph
1966-
.extend_bubble_ttl(&ctx, bubble_id, Some(Duration::from_secs(60)))
1966+
.extend_bubble_ttl(&ctx, bubble_id, Some(Duration::from_mins(1)))
19671967
.await;
19681968

19691969
// Should return an error since the bubble is expired
@@ -1982,14 +1982,14 @@ mod test {
19821982

19831983
#[mononoke::fbinit_test]
19841984
async fn extend_bubble_ttl_nonexistent_bubble_test(fb: FacebookInit) -> Result<()> {
1985-
let initial = Duration::from_secs(60);
1985+
let initial = Duration::from_mins(1);
19861986
let grace = Duration::from_secs(30);
19871987
let (ctx, _, _, eph) = bootstrap(fb, initial, grace, BubbleDeletionMode::MarkAndDelete)?;
19881988

19891989
// Try to extend TTL of a non-existent bubble
19901990
let fake_bubble_id = BubbleId::new(std::num::NonZeroU64::new(99999).unwrap());
19911991
let result = eph
1992-
.extend_bubble_ttl(&ctx, fake_bubble_id, Some(Duration::from_secs(60)))
1992+
.extend_bubble_ttl(&ctx, fake_bubble_id, Some(Duration::from_mins(1)))
19931993
.await;
19941994

19951995
// Should return an error since the bubble doesn't exist
@@ -2008,7 +2008,7 @@ mod test {
20082008

20092009
#[mononoke::fbinit_test]
20102010
async fn extend_bubble_ttl_with_labels_test(fb: FacebookInit) -> Result<()> {
2011-
let initial = Duration::from_secs(60);
2011+
let initial = Duration::from_mins(1);
20122012
let grace = Duration::from_secs(30);
20132013
let (ctx, _, _, eph) = bootstrap(fb, initial, grace, BubbleDeletionMode::MarkAndDelete)?;
20142014

@@ -2039,7 +2039,7 @@ mod test {
20392039

20402040
#[mononoke::fbinit_test]
20412041
async fn extend_bubble_ttl_multiple_times_test(fb: FacebookInit) -> Result<()> {
2042-
let initial = Duration::from_secs(60);
2042+
let initial = Duration::from_mins(1);
20432043
let grace = Duration::from_secs(30);
20442044
let (ctx, _, _, eph) = bootstrap(fb, initial, grace, BubbleDeletionMode::MarkAndDelete)?;
20452045

@@ -2061,7 +2061,7 @@ mod test {
20612061

20622062
// Third extension with shorter duration (should not change)
20632063
let result3 = eph
2064-
.extend_bubble_ttl(&ctx, bubble_id, Some(Duration::from_secs(60)))
2064+
.extend_bubble_ttl(&ctx, bubble_id, Some(Duration::from_mins(1)))
20652065
.await?;
20662066
assert!(matches!(result3, ExtendBubbleTtlOutcome::NotChanged(_)));
20672067

@@ -2080,7 +2080,7 @@ mod test {
20802080

20812081
#[mononoke::fbinit_test]
20822082
async fn extend_bubble_ttl_outcome_timestamps_test(fb: FacebookInit) -> Result<()> {
2083-
let initial = Duration::from_secs(60);
2083+
let initial = Duration::from_mins(1);
20842084
let grace = Duration::from_secs(30);
20852085
let (ctx, _, _, eph) = bootstrap(fb, initial, grace, BubbleDeletionMode::MarkAndDelete)?;
20862086

eden/mononoke/blobstore/redactedblobstore/src/store.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ impl ConfigeratorRedactedBlobs {
124124
) -> Result<Self> {
125125
let loader = InnerConfigLoader::new(ctx.clone(), handle, blobstore);
126126
let reloader =
127-
Reloader::reload_periodically(ctx, || std::time::Duration::from_secs(60), loader)
127+
Reloader::reload_periodically(ctx, || std::time::Duration::from_mins(1), loader)
128128
.await?;
129129

130130
Ok(ConfigeratorRedactedBlobs(reloader))

eden/mononoke/features/async_requests/src/queue.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ use crate::types::ThriftParams;
4444
use crate::types::Token;
4545

4646
const INITIAL_POLL_DELAY_MS: u64 = 1000;
47-
const MAX_POLL_DURATION: Duration = Duration::from_secs(60);
47+
const MAX_POLL_DURATION: Duration = Duration::from_mins(1);
4848
const JK_RETRY_LIMIT: &str = "scm/mononoke:async_requests_retry_limit";
4949

5050
define_stats! {

eden/mononoke/features/cross_repo_sync/src/commit_syncers_lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ use crate::types::Repo;
7272
use crate::types::Source;
7373
use crate::types::Target;
7474

75-
const LEASE_WARNING_THRESHOLD: Duration = Duration::from_secs(60);
75+
const LEASE_WARNING_THRESHOLD: Duration = Duration::from_mins(1);
7676

7777
pub(crate) async fn remap_parents<'a, R: Repo>(
7878
ctx: &CoreContext,

eden/mononoke/features/repo_stats_logger/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ impl RepoStatsLogger {
5555

5656
let fut = async move {
5757
loop {
58-
let interval = Duration::from_secs(60);
58+
let interval = Duration::from_mins(1);
5959
tokio::time::sleep(interval).await;
6060

6161
let repo_key = encode_repo_name(&repo_name);

eden/mononoke/lfs_server/src/download.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ define_stats! {
4848
size_bytes_sent: timeseries(
4949
"size_bytes_sent";
5050
Sum;
51-
Duration::from_secs(5), Duration::from_secs(15), Duration::from_secs(60)
51+
Duration::from_secs(5), Duration::from_secs(15), Duration::from_mins(1)
5252
),
5353
net_util: timeseries(
5454
"net_util";
5555
Average;
56-
Duration::from_secs(5), Duration::from_secs(15), Duration::from_secs(60)
56+
Duration::from_secs(5), Duration::from_secs(15), Duration::from_mins(1)
5757
),
5858
load_shed_counter: dynamic_singleton_counter("{}", (key: String)),
5959
}

eden/mononoke/rate_limiting/src/lib.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ impl RateLimitEnvironment {
117117

118118
mononoke::spawn_task(periodic_fetch_counter(
119119
counter_manager.clone(),
120-
Duration::from_secs(60),
120+
Duration::from_mins(1),
121121
));
122122

123123
Self {
@@ -150,7 +150,7 @@ impl RateLimitEnvironment {
150150

151151
runtime.spawn(periodic_fetch_counter(
152152
counter_manager.clone(),
153-
Duration::from_secs(60),
153+
Duration::from_mins(1),
154154
));
155155

156156
Self {
@@ -608,7 +608,7 @@ mod test {
608608
target: Some(Target::MainClientId("client_id".to_string())),
609609
fci_metric: FciMetric {
610610
metric: Metric::EgressBytes,
611-
window: Duration::from_secs(60),
611+
window: Duration::from_mins(1),
612612
scope: Scope::Global,
613613
},
614614
};
@@ -620,7 +620,7 @@ mod test {
620620
)),
621621
fci_metric: FciMetric {
622622
metric: Metric::EgressBytes,
623-
window: Duration::from_secs(60),
623+
window: Duration::from_mins(1),
624624
scope: Scope::Global,
625625
},
626626
};
@@ -630,7 +630,7 @@ mod test {
630630
target: Some(Target::Identities([].into())),
631631
fci_metric: FciMetric {
632632
metric: Metric::EgressBytes,
633-
window: Duration::from_secs(60),
633+
window: Duration::from_mins(1),
634634
scope: Scope::Global,
635635
},
636636
};

0 commit comments

Comments
 (0)