Skip to content

Commit

Permalink
[FLINK-15489][web] Avoid caching of JM and TM logs in the web ui
Browse files Browse the repository at this point in the history
This adds the 'Cache-Control: no-cache' HTTP header when requesting TM or TM
logs.

This closes apache#10842.
  • Loading branch information
vthinkxie authored and GJL committed Jan 16, 2020
1 parent 1bec3d2 commit 8712667
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

import { HttpClient } from '@angular/common/http';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { BASE_URL } from 'config';

Expand All @@ -35,14 +35,20 @@ export class JobManagerService {
* Load JM logs
*/
loadLogs() {
return this.httpClient.get(`${BASE_URL}/jobmanager/log`, { responseType: 'text' });
return this.httpClient.get(`${BASE_URL}/jobmanager/log`, {
responseType: 'text',
headers: new HttpHeaders().append('Cache-Control', 'no-cache')
});
}

/**
* Load JM stdout
*/
loadStdout() {
return this.httpClient.get(`${BASE_URL}/jobmanager/stdout`, { responseType: 'text' });
return this.httpClient.get(`${BASE_URL}/jobmanager/stdout`, {
responseType: 'text',
headers: new HttpHeaders().append('Cache-Control', 'no-cache')
});
}

constructor(private httpClient: HttpClient) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

import { HttpClient } from '@angular/common/http';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { EMPTY, of, ReplaySubject } from 'rxjs';
import { catchError, map } from 'rxjs/operators';
Expand Down Expand Up @@ -54,15 +54,21 @@ export class TaskManagerService {
* @param taskManagerId
*/
loadLogs(taskManagerId: string) {
return this.httpClient.get(`${BASE_URL}/taskmanagers/${taskManagerId}/log`, { responseType: 'text' });
return this.httpClient.get(`${BASE_URL}/taskmanagers/${taskManagerId}/log`, {
responseType: 'text',
headers: new HttpHeaders().append('Cache-Control', 'no-cache')
});
}

/**
* Load TM stdout
* @param taskManagerId
*/
loadStdout(taskManagerId: string) {
return this.httpClient.get(`${BASE_URL}/taskmanagers/${taskManagerId}/stdout`, { responseType: 'text' });
return this.httpClient.get(`${BASE_URL}/taskmanagers/${taskManagerId}/stdout`, {
responseType: 'text',
headers: new HttpHeaders().append('Cache-Control', 'no-cache')
});
}

constructor(private httpClient: HttpClient) {}
Expand Down

0 comments on commit 8712667

Please sign in to comment.