Skip to content

Commit

Permalink
fix: use parrent-like add methode in pipleine
Browse files Browse the repository at this point in the history
  • Loading branch information
ms-fadaei committed Nov 7, 2021
1 parent 778040e commit 0cef38e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/runners/pipeline-tasks-runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ export class PipelineTasksRunner<T> extends BaseTasksRunner<T> {
}

public add(...tasks: PipelineTask<T>[]): number {
if (this.status !== "open") {
throw new Error("task runner is not open to add new task");
// can't add tasks if the runner is closed
if (this.status === "open") {
return this.tasks.push(...tasks) - 1;
}

return this.tasks.push(...tasks) - 1;
return -1;
}

public remove(start: number, count = 1): PipelineTask<T>[] {
Expand Down

0 comments on commit 0cef38e

Please sign in to comment.