mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
Setting cache period to zero for all instances where forceBypassCache was previously true.
This commit is contained in:
@@ -44,6 +44,7 @@ export class AuthRequestService {
|
|||||||
map((endpointURL) => this.getEndpointByMethod(endpointURL, method)),
|
map((endpointURL) => this.getEndpointByMethod(endpointURL, method)),
|
||||||
distinctUntilChanged(),
|
distinctUntilChanged(),
|
||||||
map((endpointURL: string) => new AuthPostRequest(this.requestService.generateRequestId(), endpointURL, body, options)),
|
map((endpointURL: string) => new AuthPostRequest(this.requestService.generateRequestId(), endpointURL, body, options)),
|
||||||
|
map ((request: PostRequest) => request.responseMsToLive = 0),
|
||||||
tap((request: PostRequest) => this.requestService.configure(request)),
|
tap((request: PostRequest) => this.requestService.configure(request)),
|
||||||
mergeMap((request: PostRequest) => this.fetchRequest(request)),
|
mergeMap((request: PostRequest) => this.fetchRequest(request)),
|
||||||
distinctUntilChanged());
|
distinctUntilChanged());
|
||||||
@@ -55,6 +56,7 @@ export class AuthRequestService {
|
|||||||
map((endpointURL) => this.getEndpointByMethod(endpointURL, method)),
|
map((endpointURL) => this.getEndpointByMethod(endpointURL, method)),
|
||||||
distinctUntilChanged(),
|
distinctUntilChanged(),
|
||||||
map((endpointURL: string) => new AuthGetRequest(this.requestService.generateRequestId(), endpointURL, options)),
|
map((endpointURL: string) => new AuthGetRequest(this.requestService.generateRequestId(), endpointURL, options)),
|
||||||
|
map ((request: GetRequest) => request.responseMsToLive = 0),
|
||||||
tap((request: GetRequest) => this.requestService.configure(request)),
|
tap((request: GetRequest) => this.requestService.configure(request)),
|
||||||
mergeMap((request: GetRequest) => this.fetchRequest(request)),
|
mergeMap((request: GetRequest) => this.fetchRequest(request)),
|
||||||
distinctUntilChanged());
|
distinctUntilChanged());
|
||||||
|
@@ -49,6 +49,7 @@ export abstract class DataService<T extends CacheableObject> {
|
|||||||
protected abstract notificationsService: NotificationsService;
|
protected abstract notificationsService: NotificationsService;
|
||||||
protected abstract http: HttpClient;
|
protected abstract http: HttpClient;
|
||||||
protected abstract comparator: ChangeAnalyzer<T>;
|
protected abstract comparator: ChangeAnalyzer<T>;
|
||||||
|
protected resetMsToLive = false;
|
||||||
|
|
||||||
public abstract getBrowseEndpoint(options: FindAllOptions, linkPath?: string): Observable<string>
|
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)))
|
first((href: string) => hasValue(href)))
|
||||||
.subscribe((href: string) => {
|
.subscribe((href: string) => {
|
||||||
const request = new FindAllRequest(this.requestService.generateRequestId(), href, options);
|
const request = new FindAllRequest(this.requestService.generateRequestId(), href, options);
|
||||||
|
if (this.resetMsToLive) {
|
||||||
|
request.responseMsToLive = 0;
|
||||||
|
}
|
||||||
this.requestService.configure(request);
|
this.requestService.configure(request);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -153,6 +157,9 @@ export abstract class DataService<T extends CacheableObject> {
|
|||||||
find((href: string) => hasValue(href)))
|
find((href: string) => hasValue(href)))
|
||||||
.subscribe((href: string) => {
|
.subscribe((href: string) => {
|
||||||
const request = new FindByIDRequest(this.requestService.generateRequestId(), href, id);
|
const request = new FindByIDRequest(this.requestService.generateRequestId(), href, id);
|
||||||
|
if (this.resetMsToLive) {
|
||||||
|
request.responseMsToLive = 0;
|
||||||
|
}
|
||||||
this.requestService.configure(request);
|
this.requestService.configure(request);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -160,7 +167,11 @@ export abstract class DataService<T extends CacheableObject> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
findByHref(href: string, options?: HttpOptions): Observable<RemoteData<T>> {
|
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);
|
return this.rdbService.buildSingle<T>(href);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,6 +202,7 @@ export abstract class DataService<T extends CacheableObject> {
|
|||||||
first((href: string) => hasValue(href)))
|
first((href: string) => hasValue(href)))
|
||||||
.subscribe((href: string) => {
|
.subscribe((href: string) => {
|
||||||
const request = new FindAllRequest(this.requestService.generateRequestId(), href, options);
|
const request = new FindAllRequest(this.requestService.generateRequestId(), href, options);
|
||||||
|
request.responseMsToLive = 0;
|
||||||
this.requestService.configure(request);
|
this.requestService.configure(request);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -6,7 +6,7 @@ import { distinctUntilChanged, filter, flatMap, map, mergeMap, tap } from 'rxjs/
|
|||||||
import { RequestService } from '../data/request.service';
|
import { RequestService } from '../data/request.service';
|
||||||
import { isNotEmpty } from '../../shared/empty.util';
|
import { isNotEmpty } from '../../shared/empty.util';
|
||||||
import {
|
import {
|
||||||
DeleteRequest,
|
DeleteRequest, GetRequest,
|
||||||
PostRequest,
|
PostRequest,
|
||||||
RestRequest,
|
RestRequest,
|
||||||
SubmissionDeleteRequest,
|
SubmissionDeleteRequest,
|
||||||
@@ -109,6 +109,7 @@ export class SubmissionRestService {
|
|||||||
filter((href: string) => isNotEmpty(href)),
|
filter((href: string) => isNotEmpty(href)),
|
||||||
distinctUntilChanged(),
|
distinctUntilChanged(),
|
||||||
map((endpointURL: string) => new SubmissionRequest(requestId, endpointURL)),
|
map((endpointURL: string) => new SubmissionRequest(requestId, endpointURL)),
|
||||||
|
map ((request: RestRequest) => request.responseMsToLive = 0),
|
||||||
tap((request: RestRequest) => this.requestService.configure(request)),
|
tap((request: RestRequest) => this.requestService.configure(request)),
|
||||||
flatMap(() => this.fetchRequest(requestId)),
|
flatMap(() => this.fetchRequest(requestId)),
|
||||||
distinctUntilChanged());
|
distinctUntilChanged());
|
||||||
|
@@ -20,6 +20,7 @@ import { DSOChangeAnalyzer } from '../data/dso-change-analyzer.service';
|
|||||||
@Injectable()
|
@Injectable()
|
||||||
export class WorkflowItemDataService extends DataService<WorkflowItem> {
|
export class WorkflowItemDataService extends DataService<WorkflowItem> {
|
||||||
protected linkPath = 'workflowitems';
|
protected linkPath = 'workflowitems';
|
||||||
|
protected resetMsToLive = true;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
protected comparator: DSOChangeAnalyzer<WorkflowItem>,
|
protected comparator: DSOChangeAnalyzer<WorkflowItem>,
|
||||||
|
@@ -20,6 +20,7 @@ import { WorkspaceItem } from './models/workspaceitem.model';
|
|||||||
@Injectable()
|
@Injectable()
|
||||||
export class WorkspaceitemDataService extends DataService<WorkspaceItem> {
|
export class WorkspaceitemDataService extends DataService<WorkspaceItem> {
|
||||||
protected linkPath = 'workspaceitems';
|
protected linkPath = 'workspaceitems';
|
||||||
|
protected resetMsToLive = true;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
protected comparator: DSOChangeAnalyzer<WorkspaceItem>,
|
protected comparator: DSOChangeAnalyzer<WorkspaceItem>,
|
||||||
|
@@ -22,6 +22,8 @@ import { ProcessTaskResponse } from './models/process-task-response';
|
|||||||
@Injectable()
|
@Injectable()
|
||||||
export class ClaimedTaskDataService extends TasksService<ClaimedTask> {
|
export class ClaimedTaskDataService extends TasksService<ClaimedTask> {
|
||||||
|
|
||||||
|
protected resetMsToLive = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The endpoint link name
|
* The endpoint link name
|
||||||
*/
|
*/
|
||||||
|
@@ -27,6 +27,8 @@ export class PoolTaskDataService extends TasksService<PoolTask> {
|
|||||||
*/
|
*/
|
||||||
protected linkPath = 'pooltasks';
|
protected linkPath = 'pooltasks';
|
||||||
|
|
||||||
|
protected resetMsToLive = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize instance variables
|
* Initialize instance variables
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user