expressjs / expressjs/timeout

Extending the timeout

Open
#26 7 comments 0 reactions 0 assignees View on GitHub
discuss ideas
Dominant language
JavaScript
Stars
320
Forks
51
PR merge metrics
No merged PRs in 30d

Description

So far as I understand it, the timeout value is set when you add the `connect-timeout` middleware when initializing the express server, so the same timeout applies to every request the comes in thereafter (that matches the route concerned).

What I'm finding is that for some incoming GET requests, there is a particular combination of options in the request that causes a network fetch to a remote resource than is not very reliable. For those requests, I'd like to relax the timeout value for `connect-timeout` somewhat, to allow for a few fetch retries.

But I can't see any way to change the timeout value 'on the fly', for a particular request. The only control I can see over the timeout is to use `req.clearTimeout()` whilst processing a request. This is helpful, but `timeout is completely removed and will not fire for this request in the future`. This is not entirely what I'm looking to achieve... I would like to retain a timeout, but just a slightly longer one.

Is what I'm asking for really naughty, breaking established rules of good practice of which I'm not aware? Or is it a reasonable thing to want to do?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.