Setting cache period to zero for all instances where forceBypassCache was previously true.

This commit is contained in:
Michael W Spalti
2019-09-12 16:14:13 -07:00
parent 6cf8cc5fbe
commit 2988146d59
7 changed files with 23 additions and 2 deletions

View File

@@ -44,6 +44,7 @@ export class AuthRequestService {
map((endpointURL) => this.getEndpointByMethod(endpointURL, method)),
distinctUntilChanged(),
map((endpointURL: string) => new AuthPostRequest(this.requestService.generateRequestId(), endpointURL, body, options)),
map ((request: PostRequest) => request.responseMsToLive = 0),
tap((request: PostRequest) => this.requestService.configure(request)),
mergeMap((request: PostRequest) => this.fetchRequest(request)),
distinctUntilChanged());
@@ -55,6 +56,7 @@ export class AuthRequestService {
map((endpointURL) => this.getEndpointByMethod(endpointURL, method)),
distinctUntilChanged(),
map((endpointURL: string) => new AuthGetRequest(this.requestService.generateRequestId(), endpointURL, options)),
map ((request: GetRequest) => request.responseMsToLive = 0),
tap((request: GetRequest) => this.requestService.configure(request)),
mergeMap((request: GetRequest) => this.fetchRequest(request)),
distinctUntilChanged());

View File

@@ -49,6 +49,7 @@ export abstract class DataService<T extends CacheableObject> {
protected abstract notificationsService: NotificationsService;
protected abstract http: HttpClient;
protected abstract comparator: ChangeAnalyzer<T>;
protected resetMsToLive = false;
public abstract getBrowseEndpoint(options: FindAllOptions, linkPath?: string): Observable<string>
@@ -130,6 +131,9 @@ export abstract class DataService<T extends CacheableObject> {
first((href: string) => hasValue(href)))
.subscribe((href: string) => {
const request = new FindAllRequest(this.requestService.generateRequestId(), href, options);
if (this.resetMsToLive) {
request.responseMsToLive = 0;
}
this.requestService.configure(request);
});
@@ -153,6 +157,9 @@ export abstract class DataService<T extends CacheableObject> {
find((href: string) => hasValue(href)))
.subscribe((href: string) => {
const request = new FindByIDRequest(this.requestService.generateRequestId(), href, id);
if (this.resetMsToLive) {
request.responseMsToLive = 0;
}
this.requestService.configure(request);
});
@@ -160,7 +167,11 @@ export abstract class DataService<T extends CacheableObject> {
}
findByHref(href: string, options?: HttpOptions): Observable<RemoteData<T>> {
this.requestService.configure(new GetRequest(this.requestService.generateRequestId(), href, null, options));
const request = new GetRequest(this.requestService.generateRequestId(), href, null, options);
if (this.resetMsToLive) {
request.responseMsToLive = 0;
}
this.requestService.configure(request);
return this.rdbService.buildSingle<T>(href);
}
@@ -191,6 +202,7 @@ export abstract class DataService<T extends CacheableObject> {
first((href: string) => hasValue(href)))
.subscribe((href: string) => {
const request = new FindAllRequest(this.requestService.generateRequestId(), href, options);
request.responseMsToLive = 0;
this.requestService.configure(request);
});

View File

@@ -6,7 +6,7 @@ import { distinctUntilChanged, filter, flatMap, map, mergeMap, tap } from 'rxjs/
import { RequestService } from '../data/request.service';
import { isNotEmpty } from '../../shared/empty.util';
import {
DeleteRequest,
DeleteRequest, GetRequest,
PostRequest,
RestRequest,
SubmissionDeleteRequest,
@@ -109,6 +109,7 @@ export class SubmissionRestService {
filter((href: string) => isNotEmpty(href)),
distinctUntilChanged(),
map((endpointURL: string) => new SubmissionRequest(requestId, endpointURL)),
map ((request: RestRequest) => request.responseMsToLive = 0),
tap((request: RestRequest) => this.requestService.configure(request)),
flatMap(() => this.fetchRequest(requestId)),
distinctUntilChanged());

View File

@@ -20,6 +20,7 @@ import { DSOChangeAnalyzer } from '../data/dso-change-analyzer.service';
@Injectable()
export class WorkflowItemDataService extends DataService<WorkflowItem> {
protected linkPath = 'workflowitems';
protected resetMsToLive = true;
constructor(
protected comparator: DSOChangeAnalyzer<WorkflowItem>,

View File

@@ -20,6 +20,7 @@ import { WorkspaceItem } from './models/workspaceitem.model';
@Injectable()
export class WorkspaceitemDataService extends DataService<WorkspaceItem> {
protected linkPath = 'workspaceitems';
protected resetMsToLive = true;
constructor(
protected comparator: DSOChangeAnalyzer<WorkspaceItem>,

View File

@@ -22,6 +22,8 @@ import { ProcessTaskResponse } from './models/process-task-response';
@Injectable()
export class ClaimedTaskDataService extends TasksService<ClaimedTask> {
protected resetMsToLive = true;
/**
* The endpoint link name
*/

View File

@@ -27,6 +27,8 @@ export class PoolTaskDataService extends TasksService<PoolTask> {
*/
protected linkPath = 'pooltasks';
protected resetMsToLive = true;
/**
* Initialize instance variables
*