Improve Agent performance (#3804)

* pause and resume job history retrieval when opening dialogs

* review comments

* removed boolean for tab change
This commit is contained in:
Aditya Bist
2019-01-23 14:25:54 -08:00
committed by GitHub
parent 4ad059605c
commit f611cf3b5a
3 changed files with 37 additions and 43 deletions

View File

@@ -177,8 +177,10 @@ export class JobHistoryComponent extends JobManagementView implements OnInit {
} else {
self._showPreviousRuns = false;
self._showSteps = false;
if (self._agentViewComponent.showHistory) {
self._cd.detectChanges();
}
}
});
}
@@ -209,9 +211,11 @@ export class JobHistoryComponent extends JobManagementView implements OnInit {
} else {
self._showSteps = false;
}
if (self._agentViewComponent.showHistory) {
self._cd.detectChanges();
}
}
}
private didJobFail(job: sqlops.AgentJobHistoryInfo): boolean {
for (let i = 0; i < job.steps.length; i++) {

View File

@@ -262,7 +262,7 @@ jobhistory-component {
}
jobhistory-component > .jobhistory-heading-container {
display: inline-block;
display: flex;
}
jobhistory-component > .jobhistory-heading-container > .icon.in-progress {

View File

@@ -94,8 +94,6 @@ export class JobsViewComponent extends JobManagementView implements OnInit, OnDe
private jobSchedules: { [jobId: string]: sqlops.AgentJobScheduleInfo[]; } = Object.create(null);
public contextAction = NewJobAction;
private _didTabChange: boolean;
@ViewChild('jobsgrid') _gridEl: ElementRef;
constructor(
@@ -113,7 +111,6 @@ export class JobsViewComponent extends JobManagementView implements OnInit, OnDe
@Inject(ITelemetryService) private _telemetryService: ITelemetryService
) {
super(commonService, _dashboardService, contextMenuService, keybindingService, instantiationService);
this._didTabChange = false;
let jobCacheObjectMap = this._jobManagementService.jobCacheObjectMap;
let jobCache = jobCacheObjectMap[this._serverName];
if (jobCache) {
@@ -135,7 +132,6 @@ export class JobsViewComponent extends JobManagementView implements OnInit, OnDe
}
ngOnDestroy() {
this._didTabChange = true;
}
public layout() {
@@ -220,10 +216,8 @@ export class JobsViewComponent extends JobManagementView implements OnInit, OnDe
}
this._showProgressWheel = false;
if (this.isVisible && !this._didTabChange) {
if (this.isVisible) {
this._cd.detectChanges();
} else if (this._didTabChange) {
return;
}
});
}
@@ -594,8 +588,8 @@ export class JobsViewComponent extends JobManagementView implements OnInit, OnDe
private async curateJobHistory(jobs: sqlops.AgentJobInfo[], ownerUri: string) {
const self = this;
await Promise.all(jobs.map(async (job) => {
await this._jobManagementService.getJobHistory(ownerUri, job.jobId, job.name).then(async(result) => {
for (let job of jobs) {
let result = await this._jobManagementService.getJobHistory(ownerUri, job.jobId, job.name);
if (result) {
self.jobSteps[job.jobId] = result.steps ? result.steps : [];
self.jobAlerts[job.jobId] = result.alerts ? result.alerts : [];
@@ -612,10 +606,7 @@ export class JobsViewComponent extends JobManagementView implements OnInit, OnDe
} else {
previousRuns = jobHistories;
}
// dont create the charts if the tab changed
if (!self._didTabChange) {
self.createJobChart(job.jobId, previousRuns);
}
if (self._agentViewComponent.expanded.has(job.jobId)) {
let lastJobHistory = jobHistories[jobHistories.length - 1];
let item = self.dataView.getItemById(job.jobId + '.error');
@@ -626,8 +617,7 @@ export class JobsViewComponent extends JobManagementView implements OnInit, OnDe
self.dataView.updateItem(job.jobId + '.error', item);
}
}
});
}));
}
}
private createJobChart(jobId: string, jobHistories: sqlops.AgentJobHistoryInfo[]): void {