Skip to content

Commit

Permalink
drop queue before await
Browse files Browse the repository at this point in the history
  • Loading branch information
wenym1 committed Feb 4, 2024
1 parent 2438934 commit 9a0db3f
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/meta/src/barrier/schedule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -369,12 +369,11 @@ impl ScheduledBarriers {
loop {
let mut rx = self.inner.changed_tx.subscribe();
let mut queue = self.inner.queue.write().await;
if queue.queue.is_empty() {
rx.changed().await.unwrap();
if let Some(scheduled) = queue.queue.pop_front() {
break scheduled
} else {
let scheduled = queue.queue.pop_front().expect("non-empty");

break scheduled;
drop(queue);
rx.changed().await.unwrap();
}
}
} => {
Expand Down

0 comments on commit 9a0db3f

Please sign in to comment.