Skip to content

Commit

Permalink
Drain worker tasks only once
Browse files Browse the repository at this point in the history
  • Loading branch information
aduh95 authored Sep 17, 2024
1 parent a475e88 commit ab23463
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/node_platform.cc
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,8 @@ void NodePlatform::DrainTasks(Isolate* isolate) {
std::shared_ptr<PerIsolatePlatformData> per_isolate = ForNodeIsolate(isolate);
if (!per_isolate) return;

// Worker tasks aren't associated with an Isolate.
worker_thread_task_runner_->BlockingDrain();
// Drain foreground tasks but not worker tasks as this may cause deadlocks
// and v8::Isolate::Dispose will join V8's worker tasks for that isolate.
while (per_isolate->FlushForegroundTasksInternal()) {
Expand Down

0 comments on commit ab23463

Please sign in to comment.