Skip to content

Commit ecff84d

Browse files
committed
permit
1 parent 2b1a664 commit ecff84d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

turbopack/crates/turbo-tasks/src/manager.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -711,6 +711,7 @@ impl<B: Backend + 'static> TurboTasks<B> {
711711
};
712712

713713
async {
714+
let _permit = this.semaphore.acquire().await.unwrap();
714715
let (result, duration, memory_usage) = CaptureFuture::new(future).await;
715716

716717
// wait for all spawned local tasks using `local` to finish
@@ -763,7 +764,7 @@ impl<B: Backend + 'static> TurboTasks<B> {
763764
.unwrap();
764765
}
765766
#[cfg(not(feature = "tokio_tracing"))]
766-
tokio::task::spawn(future);
767+
tokio::spawn(future);
767768
}
768769

769770
fn schedule_local_task(
@@ -811,6 +812,7 @@ impl<B: Backend + 'static> TurboTasks<B> {
811812
crate::task::local_task::get_local_task_execution_spec(&*this, &ty, persistence);
812813
let ty = ty.clone();
813814
async move {
815+
let _permit = this.semaphore.acquire().await.unwrap();
814816
let (result, _duration, _memory_usage) = CaptureFuture::new(future).await;
815817

816818
let result = match result {
@@ -854,7 +856,7 @@ impl<B: Backend + 'static> TurboTasks<B> {
854856
.spawn(future)
855857
.unwrap();
856858
#[cfg(not(feature = "tokio_tracing"))]
857-
tokio::task::spawn(future);
859+
tokio::spawn(future);
858860

859861
RawVc::LocalOutput(execution_id, local_task_id, persistence)
860862
}
@@ -1117,6 +1119,7 @@ impl<B: Backend + 'static> TurboTasks<B> {
11171119
}
11181120
let this2 = this.clone();
11191121
if !this.stopped.load(Ordering::Acquire) {
1122+
let _permit = this2.semaphore.acquire().await.unwrap();
11201123
func(this).await;
11211124
}
11221125
if this2
@@ -1145,6 +1148,7 @@ impl<B: Backend + 'static> TurboTasks<B> {
11451148
TURBO_TASKS
11461149
.scope(this.clone(), async move {
11471150
if !this.stopped.load(Ordering::Acquire) {
1151+
let _permit = this.semaphore.acquire().await.unwrap();
11481152
func(this.clone()).await;
11491153
}
11501154
this.finish_foreground_job();

0 commit comments

Comments
 (0)