The user should be able to change the requests timeout
See original GitHub issueSince we removed axios and we are using fetch:
By default a fetch() request timeouts at the time setup by the browser. In Chrome, for example, this setting equals 300 seconds. That’s way longer than a user would expect for a simple network request to complete.

It lasted for about 2 min when I tried.
Should we give the possibility to users to define their own timeout when using MeiliSearch? This should then be done during client creation in the following way (or another):
const client = new window.MeiliSearch({
host: 'http://google.com:81',
apiKey: 'masterKey',
timeout: 30000
})
It is done this way in Algolia:
const index = client.initIndex('indexName');
const requestOptions = {
// Set the readTimeout to 20 seconds
timeouts: { read: 20 }
}
index.search('query string', requestOptions)
.then(({ hits }) => {
console.log(hits);
});
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:11 (6 by maintainers)
Top Results From Across the Web
Timeout for python requests.get entire response - Stack Overflow
Set the timeout parameter: r = requests.get(w, verify=False, timeout=10) # 10 seconds. Changes in version 2.25.1. The code above will cause the call...
Read more >Timeouts in Python requests - Datagy
In order to set a timeout in an HTTP request made via the requests library, you can use the timeout parameter. The parameter...
Read more >How do I set a timeout for Python Requests? - ReqBin
To set a timeout for the Python Requests library, you can pass the "timeout" parameter for GET, POST, PUT, HEAD, and DELETE methods....
Read more >Python Best Practices: always use a timeout with the requests ...
However, if used improperly, the requests library can cause ... the best way is to set a timeout in the requests.get or requests.put...
Read more >Timeout in Python requests – Everything you need to know
You can tell requests library to stop waiting for a response after a given amount of time by passing a number to the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

We should be able to provide the timeout when creating the client. A bit like the ruby client.
Then, pass the information to the request class. Where you can add the timeout to the fetch options if provided or use the default one if it is not.
If you need more information do not hesitate
I would like to work on this issue.