question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The user should be able to change the requests timeout

See original GitHub issue

Since 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.

Screenshot 2020-12-10 at 17 31 41 Screenshot 2020-12-10 at 17 31 48

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:open
  • Created 3 years ago
  • Reactions:1
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
bidoubiwacommented, Oct 4, 2021

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

2reactions
VoidCupboardcommented, Oct 3, 2021

I would like to work on this issue.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found