Skip to content

re: fetch with a timeout VIEW POST

re: That is amazing! Never thought of using setTimeout to reject the returned promise. One question: shouldn't the timeout usually be set on the back-...

This is very good question, which I haven't asked myself - blind spot in my brain, because I got used to it.

I guess you need timeout on client-side, if server timeout is longer than you want. For example you need to upload big files to this server and as the result timeout of all endpoints increased, not just one.

The second case, is if you guard against slow network. For example 2G connections or if your server is in Europe, but users are in Australia or Japan.

And maybe you actually right and we don't need it in first place. I just thought - "hey, everybody is doing it with timeout, but without cancel. Let me share this"

code of conduct - report abuse