Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Priority management between Default Data Providers #1641

Open
bastoune opened this issue Sep 3, 2020 · 2 comments
Open

[Feature Request] Priority management between Default Data Providers #1641

bastoune opened this issue Sep 3, 2020 · 2 comments

Comments

@bastoune
Copy link

@bastoune bastoune commented Sep 3, 2020

Description
Using Doctrine & ElasticSearch Provider, I would like to prioritize those. For example, currently, if my ES is down, my doctrine entities can't be reached and I get a 500 with No alive nodes found in your cluster.
It could be fixed by adding a priority order in the default providers as it exists in custom ones => https://api-platform.com/docs/core/data-providers/#custom-collection-data-provider

Example
For example, it could be a priority in app/config/packages/api_platform.yaml like

[...]
    elasticsearch:
       priority: 2

And doctrine would have a priority of 0 or -1

@rugolinifr
Copy link

@rugolinifr rugolinifr commented Sep 7, 2020

Are you sure this is enough ? It appears to me that all useful data providers are instanciated, then passed to a ApiPlatform\Core\Bridge\Symfony\Bundle\DataProvider\TraceableChainCollectionDataProvider. If the connection is done while the __construct() method, you're screwed.

@bastoune
Copy link
Author

@bastoune bastoune commented Sep 8, 2020

Are you sure this is enough ? It appears to me that all useful data providers are instanciated, then passed to a ApiPlatform\Core\Bridge\Symfony\Bundle\DataProvider\TraceableChainCollectionDataProvider. If the connection is done while the __construct() method, you're screwed.

You are right, would you have a better idea ?

Maybe the best would be to be able to specify which resource depends on which DataProvider rather than trying all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.