Slow successful Windows helper time refreshes
Rust development slice / linux (push) Failing after 8s
Rust development slice / linux (push) Failing after 8s
(cherry picked from commit a4bcebf440)
This commit is contained in:
@@ -31,6 +31,15 @@ impl SamplingMode {
|
||||
(Self::Jobs, false) => Duration::from_millis(500),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn helper_interval(self, verified: bool) -> std::time::Duration {
|
||||
match (self, verified) {
|
||||
// Each refresh verifies both service images over the pipe. A held
|
||||
// signed time sample remains usable for up to five minutes.
|
||||
(Self::Jobs, true) => std::time::Duration::from_secs(5),
|
||||
_ => self.interval(verified),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn independent_time_key(time_key_hex: &str, job_key_hex: &str) -> Result<[u8; 32]> {
|
||||
@@ -1647,6 +1656,26 @@ mod tests {
|
||||
}
|
||||
std::fs::remove_dir_all(dir).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn helper_sampling_spaces_successes_and_retries_failures_quickly() {
|
||||
use std::time::Duration;
|
||||
assert_eq!(
|
||||
SamplingMode::Jobs.helper_interval(true),
|
||||
Duration::from_secs(5)
|
||||
);
|
||||
assert_eq!(
|
||||
SamplingMode::Jobs.helper_interval(false),
|
||||
Duration::from_millis(500)
|
||||
);
|
||||
for verified in [false, true] {
|
||||
assert_eq!(
|
||||
SamplingMode::Passive.helper_interval(verified),
|
||||
Duration::from_secs(30)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
fn sample(ns: u64) -> Sample {
|
||||
Sample {
|
||||
wall_utc_ns: 1_800_000_000_000_000_000 + ns as i64,
|
||||
|
||||
Reference in New Issue
Block a user