pub fn declare_timings(policy: &ServerPolicy)Expand description
Declare the timings for this process from a repository’s policy. The first call decides;
later ones are ignored, which is what makes timings answer the same thing all the way
through one contest.
use majordomus_cli::lease::{declare_timings, timings};
use majordomus_cli::policy::ServerPolicy;
use std::time::Duration;
// the first declaration is the one in force
declare_timings(&ServerPolicy { busy_grace_seconds: Some(4), ..ServerPolicy::default() });
assert_eq!(timings().busy_grace, Duration::from_secs(4));
// a later one cannot move a judgement already being made
declare_timings(&ServerPolicy { busy_grace_seconds: Some(9), ..ServerPolicy::default() });
assert_eq!(timings().busy_grace, Duration::from_secs(4));