diff --git a/features/setup/multirepository/multirepository.feature b/features/setup/multirepository/multirepository.feature index 9a4ff5f0..1f8b357e 100644 --- a/features/setup/multirepository/multirepository.feature +++ b/features/setup/multirepository/multirepository.feature @@ -1,6 +1,6 @@ Feature: Multirepository setup for testing - @multirepository + @multirepository Scenario: Set up new repository and make the default one unaccessible Given I set configuration to "doctrine.dbal" in "config/packages/doctrine.yaml" """ diff --git a/features/setup/multirepository/multirepository_elastic.feature b/features/setup/multirepository/multirepository_elastic.feature new file mode 100644 index 00000000..12e350cb --- /dev/null +++ b/features/setup/multirepository/multirepository_elastic.feature @@ -0,0 +1,17 @@ +Feature: Multirepository setup for testing with Elastic + + @elastic + Scenario: Set up new connection and make the default one unaccessible + Given I append configuration to "parameters" in "config/packages/ibexa_elasticsearch.yaml" + """ + elasticsearch_dsn_invalid: "INVALID" + """ + And I set configuration to "ibexa_elasticsearch.connections" in "config/packages/ibexa_elasticsearch.yaml" + """ + default: + hosts: + - "%elasticsearch_dsn_invalid%" + second_connection: + hosts: + - "%elasticsearch_dsn%" + """ diff --git a/features/setup/multirepository/multirepository_solr.feature b/features/setup/multirepository/multirepository_solr.feature new file mode 100644 index 00000000..4c340655 --- /dev/null +++ b/features/setup/multirepository/multirepository_solr.feature @@ -0,0 +1,30 @@ +Feature: Multirepository setup for testing with Solr + + @solr + Scenario: Set up new connection and make the default one unaccessible + Given I append configuration to "parameters" in "config/packages/ibexa_solr.yaml" + """ + solr_dsn_invalid: 'INVALID' + solr_core_invalid: 'INVALID' + """ + And I set configuration to "ibexa_solr" in "config/packages/ibexa_solr.yaml" + """ + endpoints: + endpoint0: + dsn: '%solr_dsn%' + core: '%solr_core%' + endpoint1_invalid: + dsn: '%solr_dsn_invalid%' + core: '%solr_core_invalid%' + connections: + default: + entry_endpoints: + - endpoint1_invalid + mapping: + default: endpoint1_invalid + second_connection: + entry_endpoints: + - endpoint0 + mapping: + default: endpoint0 + """ diff --git a/src/lib/API/Facade/UserFacade.php b/src/lib/API/Facade/UserFacade.php index 6d343d25..cf64cdeb 100644 --- a/src/lib/API/Facade/UserFacade.php +++ b/src/lib/API/Facade/UserFacade.php @@ -135,15 +135,21 @@ private function loadLegacyUserGroupByName(string $userGroupName): UserGroup new Criterion\ContentTypeIdentifier(self::USERGROUP_CONTENT_IDENTIFIER), ]); - $result = $this->searchService->findContent($query); + $iteration_count = 5; + + while ($iteration_count > 0) { + $result = $this->searchService->findContent($query); - foreach ($result->searchHits as $searchHit) { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content $content */ - $content = $searchHit->valueObject; + foreach ($result->searchHits as $searchHit) { + /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content $content */ + $content = $searchHit->valueObject; - if ($content->contentInfo->name === $userGroupName) { - return $this->userService->loadUserGroup($content->contentInfo->id); + if ($content->contentInfo->name === $userGroupName) { + return $this->userService->loadUserGroup($content->contentInfo->id); + } } + usleep(500000); + --$iteration_count; } throw new NotFoundException('User Group', $userGroupName);