diff --git a/app/components/pipeline/workflow/component.js b/app/components/pipeline/workflow/component.js index d256c3309..d48f19849 100644 --- a/app/components/pipeline/workflow/component.js +++ b/app/components/pipeline/workflow/component.js @@ -51,6 +51,8 @@ export default class PipelineWorkflowComponent extends Component { eventType; + dataReloadId; + constructor() { super(...arguments); @@ -64,9 +66,9 @@ export default class PipelineWorkflowComponent extends Component { : PR_EVENT; if (this.eventType === PIPELINE_EVENT) { - this.workflowDataReload.start(pipeline.id, false); + this.dataReloadId = this.workflowDataReload.start(pipeline.id, false); } else { - this.workflowDataReload.start(pipeline.id, true); + this.dataReloadId = this.workflowDataReload.start(pipeline.id, true); } if (this.args.noEvents) { @@ -110,7 +112,7 @@ export default class PipelineWorkflowComponent extends Component { willDestroy() { super.willDestroy(); - this.workflowDataReload.stop(); + this.workflowDataReload.stop(this.dataReloadId); } @action diff --git a/app/workflow-data-reload/service.js b/app/workflow-data-reload/service.js index aa2035ece..502f26ad8 100644 --- a/app/workflow-data-reload/service.js +++ b/app/workflow-data-reload/service.js @@ -14,6 +14,10 @@ export default class WorkflowDataReloadService extends Service { requiresLatestCommitEvent; + id; + + ids; + constructor() { super(...arguments); @@ -22,10 +26,15 @@ export default class WorkflowDataReloadService extends Service { ); this.buildsReloader = new BuildsDataReloader(this.shuttle); this.openPrsReloader = new OpenPrsReloader(this.shuttle); + + this.id = 0; + this.ids = new Set(); } start(pipelineId, isPR) { - this.stop(); + this.stop(this.id); + this.id += 1; + this.ids.add(this.id); if (!isPR) { this.requiresLatestCommitEvent = true; @@ -38,11 +47,18 @@ export default class WorkflowDataReloadService extends Service { } this.buildsReloader.start(); + + return this.id; } - stop() { - this.latestCommitEventReloader.stop(); - this.buildsReloader.stop(); + stop(id) { + if (this.ids.has(id)) { + this.ids.delete(id); + + this.latestCommitEventReloader.stop(); + this.openPrsReloader.stop(); + this.buildsReloader.stop(); + } } getBuildsForEvent(eventId) {