refactor(ngcc): rename TaskQueue#markTaskCompleted() to markAsCompleted() (#36626)

Rename the `markTaskCompleted()` method to be consistent with the other
similar methods of `TaskQueue` (`markAsFailed()` and
`markAsUnprocessed()`).

PR Close #36626
This commit is contained in:
George Kalpakas
2020-04-29 21:28:09 +03:00
committed by Andrew Kushnir
parent 4665c35453
commit 16039d837e
8 changed files with 49 additions and 49 deletions

View File

@ -215,7 +215,7 @@ export class ClusterMaster {
this.onTaskCompleted(task, msg.outcome, msg.message);
this.taskQueue.markTaskCompleted(task);
this.taskQueue.markAsCompleted(task);
this.taskAssignments.set(workerId, null);
this.maybeDistributeWork();
}

View File

@ -32,7 +32,7 @@ export abstract class SingleProcessorExecutorBase {
while (!taskQueue.allTasksCompleted) {
const task = taskQueue.getNextTask()!;
compile(task);
taskQueue.markTaskCompleted(task);
taskQueue.markAsCompleted(task);
}
const duration = Math.round((Date.now() - startTime) / 1000);

View File

@ -108,7 +108,7 @@ export interface TaskQueue {
*
* @param task The task to mark as completed.
*/
markTaskCompleted(task: Task): void;
markAsCompleted(task: Task): void;
/**
* Mark a task as failed.

View File

@ -37,7 +37,7 @@ export abstract class BaseTaskQueue implements TaskQueue {
break;
}
// We are skipping this task so mark it as complete
this.markTaskCompleted(nextTask);
this.markAsCompleted(nextTask);
const failedTask = this.tasksToSkip.get(nextTask)!;
this.logger.warn(`Skipping processing of ${nextTask.entryPoint.name} because its dependency ${
failedTask.entryPoint.name} failed to compile.`);
@ -46,15 +46,7 @@ export abstract class BaseTaskQueue implements TaskQueue {
return nextTask;
}
markAsFailed(task: Task) {
if (this.dependencies.has(task)) {
for (const dependentTask of this.dependencies.get(task)!) {
this.skipDependentTasks(dependentTask, task);
}
}
}
markTaskCompleted(task: Task): void {
markAsCompleted(task: Task): void {
if (!this.inProgressTasks.has(task)) {
throw new Error(
`Trying to mark task that was not in progress as completed: ${stringifyTask(task)}`);
@ -63,6 +55,14 @@ export abstract class BaseTaskQueue implements TaskQueue {
this.inProgressTasks.delete(task);
}
markAsFailed(task: Task): void {
if (this.dependencies.has(task)) {
for (const dependentTask of this.dependencies.get(task)!) {
this.skipDependentTasks(dependentTask, task);
}
}
}
markAsUnprocessed(task: Task): void {
if (!this.inProgressTasks.has(task)) {
throw new Error(

View File

@ -41,8 +41,8 @@ export class ParallelTaskQueue extends BaseTaskQueue {
return nextTask;
}
markTaskCompleted(task: Task): void {
super.markTaskCompleted(task);
markAsCompleted(task: Task): void {
super.markAsCompleted(task);
if (!this.dependencies.has(task)) {
return;