Skip to content

Commit

Permalink
perf(pipelines): only watch status, execution label line counts
Browse files Browse the repository at this point in the history
  • Loading branch information
anotherchrisberry committed Mar 4, 2017
1 parent 448d7ae commit 6268233
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
16 changes: 14 additions & 2 deletions app/scripts/modules/core/delivery/service/execution.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ module.exports = angular.module('spinnaker.core.delivery.executions.service', [
require('../../config/settings.js'),
require('../filter/executionFilter.model.js'),
require('./executions.transformer.service.js'),
require('core/pipeline/config/pipelineConfigProvider.js'),
API_SERVICE
])
.factory('executionService', function($http, API, $timeout, $q, $log, ExecutionFilterModel, $state,
settings, appendTransform, executionsTransformer) {
settings, appendTransform, executionsTransformer, pipelineConfig) {

const activeStatuses = ['RUNNING', 'SUSPENDED', 'PAUSED', 'NOT_STARTED'];
const runningLimit = 30;
Expand Down Expand Up @@ -290,8 +291,19 @@ module.exports = angular.module('spinnaker.core.delivery.executions.service', [
}
}
}
current.stringVal = updated.stringVal;
});
current.stringVal = updated.stringVal;
current.graphStatusHash = calculateGraphStatusHash(current);
}

function calculateGraphStatusHash(execution) {
return (execution.stageSummaries || []).map(stage => {
const stageConfig = pipelineConfig.getStageConfig(stage);
if (stageConfig && stageConfig.extraLabelLines) {
return [stageConfig.extraLabelLines(stage), stage.status].join('-');
}
return stage.status;
}).join(':');
}

function updateExecution(application, updatedExecution) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,12 +310,14 @@ describe('Service: executionService', function () {
let original = {
id:1,
stringVal: 'ac',
stageSummaries: originalStages.slice()
stageSummaries: originalStages.slice(),
graphStatusHash: 'COMPLETED:RUNNING:RUNNING:NOT_STARTED',
};
let updated = {
id:1,
stringVal: 'ab',
stageSummaries: updatedStages.slice()
stageSummaries: updatedStages.slice(),
graphStatusHash: 'COMPLETED:RUNNING:RUNNING:NOT_STARTED',
};
let execs = [updated];
application.executions.data = [original];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,11 +337,9 @@ export class PipelineGraphController implements ng.IComponentController {
this.updateGraph();
if (this.shouldValidate) {
this.$scope.$watch('$ctrl.pipeline', debounce(() => this.pipelineConfigValidator.validatePipeline(this.pipeline), 300), true);
} else {
this.$scope.$watch('$ctrl.pipeline', () => this.updateGraph(), true);
}
this.$scope.$watch('$ctrl.viewState', () => { this.updateGraph(); }, true);
this.$scope.$watch('$ctrl.execution', () => this.updateGraph(), true);
this.$scope.$watch('$ctrl.execution.graphStatusHash', () => this.updateGraph());
this.$(this.$window).bind('resize.pipelineGraph-' + graphId, handleWindowResize);

this.$scope.$on('$destroy', () => {
Expand Down

0 comments on commit 6268233

Please sign in to comment.