Skip to content

Commit

Permalink
Fix out of memory crashes due to continues fetch of missing entity re…
Browse files Browse the repository at this point in the history
…lations
  • Loading branch information
richard-cox committed Sep 4, 2019
1 parent d094b29 commit 8449a07
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ export function shouldValidate(shouldSkip: boolean, isValidated: boolean, entity
return !entityInfo.fetching &&
!entityInfo.error &&
!entityInfo.deleting.busy &&
!entityInfo.deleting.deleted;
!entityInfo.deleting.deleted &&
// This is required to ensure that we don't continue trying to fetch missing relations when we're already fetching missing relations
!Object.keys(entityInfo.updating).find(key => entityInfo.updating[key].busy);
}

export function infoValidator(action: ICFAction, dispatcher) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Component, OnDestroy, OnInit } from '@angular/core';
import { FormControl, FormGroup, Validators } from '@angular/forms';
import { ActivatedRoute } from '@angular/router';
import { Store } from '@ngrx/store';
import { BehaviorSubject, Observable, of as observableOf, Subscription } from 'rxjs';
import { filter, map, mergeMap, pairwise, switchMap, take, tap } from 'rxjs/operators';
Expand All @@ -11,12 +10,14 @@ import {
} from '../../../../../../cloud-foundry/src/actions/application-service-routes.actions';
import { CreateRoute } from '../../../../../../cloud-foundry/src/actions/route.actions';
import { GetSpace } from '../../../../../../cloud-foundry/src/actions/space.actions';
import { CFAppState } from '../../../../../../cloud-foundry/src/cf-app-state';
import {
applicationEntityType,
domainEntityType,
routeEntityType,
spaceEntityType,
} from '../../../../../../cloud-foundry/src/cf-entity-factory';
import { createEntityRelationKey } from '../../../../../../cloud-foundry/src/entity-relations/entity-relations.types';
import { selectCfRequestInfo } from '../../../../../../cloud-foundry/src/store/selectors/api.selectors';
import { Route, RouteMode } from '../../../../../../cloud-foundry/src/store/types/route.types';
import { IDomain, ISpace } from '../../../../../../core/src/core/cf-api.types';
Expand All @@ -25,14 +26,11 @@ import {
StepOnNextFunction,
StepOnNextResult,
} from '../../../../../../core/src/shared/components/stepper/step/step.component';
import { PaginationMonitorFactory } from '../../../../../../core/src/shared/monitors/pagination-monitor.factory';
import { RouterNav } from '../../../../../../store/src/actions/router.actions';
import { createEntityRelationKey } from '../../../../../../cloud-foundry/src/entity-relations/entity-relations.types';
import { RequestInfoState } from '../../../../../../store/src/reducers/api-request-reducer/types';
import { APIResource } from '../../../../../../store/src/types/api.types';
import { ApplicationService } from '../../application.service';
import { CFAppState } from '../../../../../../cloud-foundry/src/cf-app-state';
import { CFEntityServiceFactory } from '../../../../cf-entity-service-factory.service';
import { ApplicationService } from '../../application.service';

const hostPattern = '^([\\w\\-\\.]*)$';
const pathPattern = `^([\\w\\-\\/\\!\\#\\[\\]\\@\\&\\$\\'\\(\\)\\*\\+\\;\\=\\,]*)$`;
Expand Down Expand Up @@ -66,11 +64,9 @@ export class AddRoutesComponent implements OnInit, OnDestroy {
addRouteMode: RouteMode;
useRandomPort = false;
constructor(
private route: ActivatedRoute,
private applicationService: ApplicationService,
private store: Store<CFAppState>,
private entityServiceFactory: CFEntityServiceFactory,
private paginationMonitorFactory: PaginationMonitorFactory
) {
this.appGuid = applicationService.appGuid;
this.cfGuid = applicationService.cfGuid;
Expand Down

0 comments on commit 8449a07

Please sign in to comment.