Skip to content

Commit

Permalink
channel: early break when fetch nothing (#13516)
Browse files Browse the repository at this point in the history
close #13394

Otherwise it will waste CPU on loop.

Signed-off-by: Jay Lee <BusyJayLee@gmail.com>

Co-authored-by: Ti Chi Robot <ti-community-prow-bot@tidb.io>
  • Loading branch information
BusyJay and ti-chi-bot committed Oct 12, 2022
1 parent c286b8a commit 066a422
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions components/tikv_util/src/mpsc/future.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,8 @@ where
for _ in 1..ctx.max_batch_size {
if let Poll::Ready(Some(m)) = ctx.rx.poll_next_unpin(cx) {
(ctx.collector)(&mut collector, m);
} else {
break;
}
}
Poll::Ready(Some(collector))
Expand Down

0 comments on commit 066a422

Please sign in to comment.