diff --git a/src/app/core/data/request.models.ts b/src/app/core/data/request.models.ts index 647f3a9b1318b86b30db56d4acc0bb8779fe56e4..5d1492592913773c31926f4aa1cf14adc7c382c7 100644 --- a/src/app/core/data/request.models.ts +++ b/src/app/core/data/request.models.ts @@ -23,6 +23,7 @@ import { TaskResponseParsingService } from '../tasks/task-response-parsing.servi export abstract class RestRequest { public responseMsToLive = 10 * 1000; + public forceBypassCache = false; constructor( public uuid: string, public href: string, @@ -281,6 +282,7 @@ export class UpdateMetadataFieldRequest extends PutRequest { * Class representing a submission HTTP GET request object */ export class SubmissionRequest extends GetRequest { + forceBypassCache = true; constructor(uuid: string, href: string) { super(uuid, href); } diff --git a/src/app/core/data/request.service.ts b/src/app/core/data/request.service.ts index 17aab032e31d46f7aa3c6febbb851b38f13a9fc6..bd651638924509afa48eb0f2916e9a859737e295 100644 --- a/src/app/core/data/request.service.ts +++ b/src/app/core/data/request.service.ts @@ -148,7 +148,7 @@ export class RequestService { */ configure<T extends CacheableObject>(request: RestRequest): void { const isGetRequest = request.method === RestRequestMethod.GET; - if (!isGetRequest || !this.isCachedOrPending(request)) { + if (!isGetRequest || request.forceBypassCache || !this.isCachedOrPending(request)) { this.dispatchRequest(request); if (isGetRequest) { this.trackRequestsOnTheirWayToTheStore(request); diff --git a/src/app/core/submission/submission-rest.service.spec.ts b/src/app/core/submission/submission-rest.service.spec.ts index e6cf3cb6b03031ffb70412916c2d3d82f853c464..30fe9f9163cf5aaca50927cd7bd567bfb59b7dd9 100644 --- a/src/app/core/submission/submission-rest.service.spec.ts +++ b/src/app/core/submission/submission-rest.service.spec.ts @@ -60,7 +60,8 @@ describe('SubmissionRestService test suite', () => { it('should configure a new SubmissionRequest', () => { const expected = new SubmissionRequest(requestService.generateRequestId(), resourceHref); // set cache time to zero - expected.responseMsToLive = 10 * 1000; + expected.responseMsToLive = 0; + expected.forceBypassCache = true; scheduler.schedule(() => service.getDataById(resourceEndpoint, resourceScope).subscribe()); scheduler.flush();