scheduler: Add missing constructs for Cloud (#37948)
This PR adds some missing constructs that are needed by Cloud to the scheduler. Release Notes: - N/A
This commit is contained in:
@@ -24,6 +24,11 @@ impl TestClock {
|
||||
}))
|
||||
}
|
||||
|
||||
pub fn set_utc_now(&self, now: DateTime<Utc>) {
|
||||
let mut state = self.0.lock();
|
||||
state.utc_now = now;
|
||||
}
|
||||
|
||||
pub fn advance(&self, duration: Duration) {
|
||||
let mut state = self.0.lock();
|
||||
state.now += duration;
|
||||
|
||||
@@ -135,6 +135,12 @@ impl TestScheduler {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn run_with_clock_advancement(&self) {
|
||||
while self.step() || self.advance_clock_to_next_timer() {
|
||||
// Continue until no work remains
|
||||
}
|
||||
}
|
||||
|
||||
fn step(&self) -> bool {
|
||||
let elapsed_timers = {
|
||||
let mut state = self.state.lock();
|
||||
|
||||
Reference in New Issue
Block a user