cleanup around runstate exit

This commit is contained in:
Mike Dilger 2024-03-29 12:29:48 +13:00
parent 3c4e5f588c
commit 7297b5d386
2 changed files with 4 additions and 4 deletions

View File

@ -83,7 +83,7 @@ pub fn start() {
task::spawn(async {
let mut read_runstate = GLOBALS.read_runstate.clone();
read_runstate.mark_unchanged();
if !read_runstate.borrow().going_online() {
if read_runstate.borrow().going_offline() {
return;
}
@ -95,7 +95,7 @@ pub fn start() {
_ = &mut sleep => {
sleep.as_mut().reset(Instant::now() + Duration::from_secs(15));
},
_ = read_runstate.wait_for(|runstate| !runstate.going_online()) => break,
_ = read_runstate.wait_for(|runstate| runstate.going_offline()) => break,
}
let pending = match Pending::compute_pending() {

View File

@ -78,7 +78,7 @@ impl People {
task::spawn(async {
let mut read_runstate = GLOBALS.read_runstate.clone();
read_runstate.mark_unchanged();
if !read_runstate.borrow().going_online() {
if read_runstate.borrow().going_offline() {
return;
}
@ -95,7 +95,7 @@ impl People {
GLOBALS.storage.read_setting_fetcher_metadata_looptime_ms();
sleep.as_mut().reset(Instant::now() + Duration::from_millis(fetch_metadata_looptime_ms));
},
_ = read_runstate.wait_for(|runstate| !runstate.going_online()) => break,
_ = read_runstate.wait_for(|runstate| runstate.going_offline()) => break,
}
// We fetch needed metadata