Skip to content

Commit

Permalink
#149309 wait for tasks recursively (#159850)
Browse files Browse the repository at this point in the history
  • Loading branch information
sandy081 authored Sep 2, 2022
1 parent 001eb8b commit 653757b
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -315,11 +315,18 @@ export abstract class AbstractExtensionManagementService extends Disposable impl

private canWaitForTask(taskToWait: IInstallExtensionTask, taskToWaitFor: IInstallExtensionTask): boolean {
for (const [, { task, waitingTasks }] of this.installingExtensions.entries()) {
// Cannot be waited, If taskToWaitFor is waiting for taskToWait
if (task === taskToWait && waitingTasks.includes(taskToWaitFor)) {
return false;
if (task === taskToWait) {
// Cannot be waited, If taskToWaitFor is waiting for taskToWait
if (waitingTasks.includes(taskToWaitFor)) {
return false;
}
// Cannot be waited, If taskToWaitFor is waiting for tasks waiting for taskToWait
if (waitingTasks.some(waitingTask => this.canWaitForTask(waitingTask, taskToWaitFor))) {
return false;
}
}
// Cannot be waited, if the taskToWait cannot be waited for the task created the taskToWaitFor
// Because, the task waits for the tasks it created
if (task === taskToWaitFor && waitingTasks[0] && !this.canWaitForTask(taskToWait, waitingTasks[0])) {
return false;
}
Expand Down

0 comments on commit 653757b

Please sign in to comment.