From 1d967c00a0591eb165b6ca5ea1d1018a27dd303e Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Sat, 5 Mar 2022 00:37:13 +0100 Subject: [PATCH] Fixing worker switchmap for edits --- worker/src/actions.ts | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/worker/src/actions.ts b/worker/src/actions.ts index af672ab..3dd25db 100644 --- a/worker/src/actions.ts +++ b/worker/src/actions.ts @@ -15,13 +15,16 @@ export class Manager { await lastValueFrom(this._pipelines .pipe( tap(x => console.log(`Found pipeline ${JSON.stringify(x)}`)), - filter(x => x.enabled), groupBy((x: Pipeline) => x.id), - switchAll(), - mergeMap((x: Pipeline) => - this.createPipeline(x).pipe( - map((env: PipelineEnv) => [x, env]), - catchError(err => this.handlePipelineError(x, err)), + mergeMap(grp => + grp.pipe( + map((x: Pipeline) => + this.createPipeline(x).pipe( + map((env: PipelineEnv) => [x, env]), + catchError(err => this.handlePipelineError(x, err)), + ) + ), + switchAll(), ) ), tap(async ([x, env]: [Pipeline, PipelineEnv]) => { @@ -38,7 +41,7 @@ export class Manager { } createPipeline(pipeline: Pipeline): Observable { - if (pipeline.type === PipelineType.Never) { + if (pipeline.type === PipelineType.Never || !pipeline.enabled) { console.log(`Deleting the pipeline ${pipeline.name}`); return NEVER; }