Skip to content

Commit

Permalink
add comments for verify mgr
Browse files Browse the repository at this point in the history
  • Loading branch information
chenyukang committed Jan 18, 2024
1 parent 3fc5ce7 commit 617c3bd
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions tx-pool/src/verify_mgr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ impl Worker {
}

pub async fn start(mut self) -> JoinHandle<()> {
// use a channel to receive the queue change event makes sure the worker
// know immediately when the queue is changed, otherwise we may have a delay of `interval`
let mut queue_rx = self.tasks.read().await.subscribe();
tokio::spawn(async move {
let mut interval = tokio::time::interval(Duration::from_millis(500));
Expand All @@ -53,7 +55,7 @@ impl Worker {
break;
}
_ = self.command_rx.changed() => {
true
*self.command_rx.borrow() == ChunkCommand::Resume
}
_ = queue_rx.changed() => {
true
Expand All @@ -70,10 +72,6 @@ impl Worker {
}

async fn process_inner(&mut self) {
if self.command_rx.borrow().to_owned() != ChunkCommand::Resume {
return;
}

if self.tasks.read().await.peek().is_none() {
return;
}
Expand Down

0 comments on commit 617c3bd

Please sign in to comment.