Skip to content

Commit

Permalink
adding missing scope
Browse files Browse the repository at this point in the history
  • Loading branch information
tanneberger committed Mar 29, 2024
1 parent 47f8bc0 commit 4be885b
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/peers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,14 @@ impl NetworkService {
info!("waiting for update to finish {}", self.updating.load(Ordering::Relaxed));
tokio::time::sleep(std::time::Duration::from_millis(500)).await
}

let lock = self.cached.read().await;
if let (next_update, stats) = lock.deref() {
if next_update < &now {
self.updating.store(true, Ordering::Relaxed);
} else {
return Ok(stats.clone());
{
let lock = self.cached.read().await;
if let (next_update, stats) = lock.deref() {
if next_update < &now {
self.updating.store(true, Ordering::Relaxed);
} else {
return Ok(stats.clone());
}
}
}

Expand Down

0 comments on commit 4be885b

Please sign in to comment.