increased responseMsToLive from 0 to 10s, to prevent infinite loops

This commit is contained in:
Art Lowel
2019-10-07 15:35:19 +02:00
committed by Michael W Spalti
parent 70a5e271f4
commit 040692455e
9 changed files with 11 additions and 41 deletions

View File

@@ -45,7 +45,7 @@ export class AuthRequestService {
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) => { map ((request: PostRequest) => {
request.responseMsToLive = 0; request.responseMsToLive = 10 * 1000;
return request; return request;
}), }),
tap((request: PostRequest) => this.requestService.configure(request)), tap((request: PostRequest) => this.requestService.configure(request)),
@@ -60,7 +60,7 @@ export class AuthRequestService {
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) => { map ((request: GetRequest) => {
request.responseMsToLive = 0; request.responseMsToLive = 10 * 1000;
return request; return request;
}), }),
tap((request: GetRequest) => this.requestService.configure(request)), tap((request: GetRequest) => this.requestService.configure(request)),

View File

@@ -205,7 +205,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; request.responseMsToLive = 10 * 1000;
this.requestService.configure(request); this.requestService.configure(request);
}); });

View File

@@ -23,7 +23,7 @@ import { MappedCollectionsReponseParsingService } from './mapped-collections-rep
/* tslint:disable:max-classes-per-file */ /* tslint:disable:max-classes-per-file */
export abstract class RestRequest { export abstract class RestRequest {
public responseMsToLive = 0; public responseMsToLive = 10 * 1000;
constructor( constructor(
public uuid: string, public uuid: string,
public href: string, public href: string,
@@ -404,7 +404,7 @@ export class TaskDeleteRequest extends DeleteRequest {
} }
export class MyDSpaceRequest extends GetRequest { export class MyDSpaceRequest extends GetRequest {
public responseMsToLive = 0; public responseMsToLive = 10 * 1000;
} }
export class RequestError extends Error { export class RequestError extends Error {

View File

@@ -60,7 +60,7 @@ describe('SubmissionRestService test suite', () => {
it('should configure a new SubmissionRequest', () => { it('should configure a new SubmissionRequest', () => {
const expected = new SubmissionRequest(requestService.generateRequestId(), resourceHref); const expected = new SubmissionRequest(requestService.generateRequestId(), resourceHref);
// set cache time to zero // set cache time to zero
expected.responseMsToLive = 0; expected.responseMsToLive = 10 * 1000;
scheduler.schedule(() => service.getDataById(resourceEndpoint, resourceScope).subscribe()); scheduler.schedule(() => service.getDataById(resourceEndpoint, resourceScope).subscribe());
scheduler.flush(); scheduler.flush();

View File

@@ -110,7 +110,7 @@ export class SubmissionRestService {
distinctUntilChanged(), distinctUntilChanged(),
map((endpointURL: string) => new SubmissionRequest(requestId, endpointURL)), map((endpointURL: string) => new SubmissionRequest(requestId, endpointURL)),
map ((request: RestRequest) => { map ((request: RestRequest) => {
request.responseMsToLive = 0; request.responseMsToLive = 10 * 1000;
return request; return request;
}), }),
tap((request: RestRequest) => this.requestService.configure(request)), tap((request: RestRequest) => this.requestService.configure(request)),

View File

@@ -20,7 +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 responseMsToLive = 0; protected responseMsToLive = 10 * 1000;
constructor( constructor(
protected comparator: DSOChangeAnalyzer<WorkflowItem>, protected comparator: DSOChangeAnalyzer<WorkflowItem>,

View File

@@ -20,7 +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 responseMsToLive = 0; protected responseMsToLive = 10 * 1000;
constructor( constructor(
protected comparator: DSOChangeAnalyzer<WorkspaceItem>, protected comparator: DSOChangeAnalyzer<WorkspaceItem>,

View File

@@ -21,20 +21,7 @@ import { ProcessTaskResponse } from './models/process-task-response';
*/ */
@Injectable() @Injectable()
export class ClaimedTaskDataService extends TasksService<ClaimedTask> { export class ClaimedTaskDataService extends TasksService<ClaimedTask> {
protected responseMsToLive = 10 * 1000;
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
protected responseMsToLive = 0;
=======
protected resetMsToLive = true;
>>>>>>> Setting cache period to zero for all instances where forceBypassCache was previously true.
=======
protected resetMsToLive = 0;
>>>>>>> Sets responseMsToLive to zero in some dataService methods and adds ability to reset the responseMsToLive value in subclasses.
=======
protected responseMsToLive = 0;
>>>>>>> Renamed cache property and replaced conditional with hasValue.
/** /**
* The endpoint link name * The endpoint link name

View File

@@ -26,25 +26,8 @@ export class PoolTaskDataService extends TasksService<PoolTask> {
* The endpoint link name * The endpoint link name
*/ */
protected linkPath = 'pooltasks'; protected linkPath = 'pooltasks';
protected responseMsToLive = 10 * 1000;
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
protected responseMsToLive = 0;
=======
>>>>>>> Refactored to remove forceBypassCache param from requestService and from data service classes.
=======
protected resetMsToLive = true;
=======
protected resetMsToLive = 0;
>>>>>>> Sets responseMsToLive to zero in some dataService methods and adds ability to reset the responseMsToLive value in subclasses.
=======
protected responseMsToLive = 0;
>>>>>>> Renamed cache property and replaced conditional with hasValue.
>>>>>>> Setting cache period to zero for all instances where forceBypassCache was previously true.
/** /**
* Initialize instance variables * Initialize instance variables
* *