Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: runtime spawn_batch does not release permit correctly #8184

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/common/base/src/base/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ impl Runtime {
Vec::with_capacity(iter.size_hint().1.unwrap_or_else(|| iter.size_hint().0));
for fut in iter {
let semaphore = semaphore.clone();
// Although async task is rather lightweight, it do consumes resources,
// Although async task is rather lightweight, it does consume resources,
// so we acquire a permit BEFORE spawn.
// Thus, the `futures` passed into this method is NOT suggested to be "materialized"
// iterator, e.g. Vec<..>
Expand All @@ -220,7 +220,7 @@ impl Runtime {
})?;
let handler = self.handle.spawn(async move {
// take the ownership of the permit, (implicitly) drop it when task is done
let _ = permit;
let _permit = permit;
fut.await
});
handlers.push(handler)
Expand Down