mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 08:47:12 +03:00
dynamicconfig: make in_timeshard accept a range
Summary: This makes it a little bit easier to use. Reviewed By: sfilipco Differential Revision: D22853717 fbshipit-source-id: aa3c1ed2a9a2d1020a48a4493a644093d8b07e67
This commit is contained in:
parent
0b76c1db46
commit
cc80592783
@ -10,6 +10,7 @@ use std::collections::HashSet;
|
||||
use std::convert::TryInto;
|
||||
use std::fs;
|
||||
use std::hash::{Hash, Hasher};
|
||||
use std::ops::Range;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::str::FromStr;
|
||||
|
||||
@ -232,12 +233,12 @@ impl Generator {
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub(crate) fn in_timeshard(&self, start: HgTime, end: HgTime) -> Result<bool> {
|
||||
pub(crate) fn in_timeshard(&self, range: Range<HgTime>) -> Result<bool> {
|
||||
let now = HgTime::now()
|
||||
.ok_or_else(|| anyhow!("invalid HgTime::now()"))?
|
||||
.to_utc();
|
||||
let start = start.to_utc();
|
||||
let end = end.to_utc();
|
||||
let start = range.start.to_utc();
|
||||
let end = range.end.to_utc();
|
||||
|
||||
let rollout = (end - start).num_seconds() as f64;
|
||||
let now = (now - start).num_seconds() as f64;
|
||||
|
Loading…
Reference in New Issue
Block a user