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

Allow specifying timeouts for API requests #297

Open
azambon opened this issue Feb 1, 2021 · 0 comments
Open

Allow specifying timeouts for API requests #297

azambon opened this issue Feb 1, 2021 · 0 comments

Comments

@azambon
Copy link

azambon commented Feb 1, 2021

Sometimes it happens that Contentful is used to serve contents that are not critical for a website, such as background images.
In these situations it would be preferrable to use short timeouts for these non-critical requests, so that a slow response from Contentful will not impair the operation of the whole website.

I'm aware that it is possible to specify a custom GuzzleHttp client (with a custom timeout value) in the ClientOptions, but that is quite cumbersome to change just one configuration option, and it only allows one to set a single, global timeout value for all requests that will use that client. Being able to specify a timeout value on a request-by-request basis would allow far more flexibility.

I was thinking of an options argument to be added to all Contentful\Delivery\Client\ClientInterface methods that involve API calls, with a default value of an empty array. When one specifies something in there, those values are merged with the underlying client option for just that request.
Of course changing the interface would be a BC break. Not for those who merely call the interface methods, but for everyone who implements it.

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

No branches or pull requests

1 participant