Drain worker tasks only once

This commit is contained in:
Antoine du Hamel 2024-09-17 14:07:21 +02:00 committed by GitHub
parent a475e8873c
commit ab23463bf5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 0 deletions

View File

@ -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()) {