diff --git a/ui-ngx/src/app/core/http/entity.service.ts b/ui-ngx/src/app/core/http/entity.service.ts index cc3459b48e..8437704faa 100644 --- a/ui-ngx/src/app/core/http/entity.service.ts +++ b/ui-ngx/src/app/core/http/entity.service.ts @@ -1007,16 +1007,40 @@ export class EntityService { private entityRelationInfosToEntitiesInfo(entityRelations: Array, direction: EntitySearchDirection): Observable> { if (entityRelations.length) { - const tasks: Observable[] = []; + const packs: Observable[][] = []; + let packTasks: Observable[] = []; entityRelations.forEach((entityRelation) => { - tasks.push(this.entityRelationInfoToEntityInfo(entityRelation, direction)); + packTasks.push(this.entityRelationInfoToEntityInfo(entityRelation, direction)); + if (packTasks.length === 100) { + packs.push(packTasks); + packTasks = []; + } }); - return forkJoin(tasks); + if (packTasks.length) { + packs.push(packTasks); + } + return this.executePack(packs, 0); } else { return of([]); } } + private executePack(packs: Observable[][], index: number): Observable> { + return forkJoin(packs[index]).pipe( + expand(() => { + index++; + if (packs[index]) { + return forkJoin(packs[index]); + } else { + return EMPTY; + } + } + ), + concatMap((data) => data), + toArray() + ); + } + private entityRelationInfoToEntityInfo(entityRelationInfo: EntityRelationInfo, direction: EntitySearchDirection): Observable { const entityId = direction === EntitySearchDirection.FROM ? entityRelationInfo.to : entityRelationInfo.from; return this.getEntity(entityId.entityType as EntityType, entityId.id, {ignoreLoading: true, ignoreErrors: true}).pipe(