Comments (7)
haha, I thought of that solution as well, and oops, forgot to mention it above. Yea, that is a good solution; I'll definitely work to implement, but not 100% sure if it'll be today, so please feel free to work on that implementation :) AFAIK, req.setTimeout
method already exists, so will probably need to refactor some stuff not to shadow that method.
from timeout.
Hi @drmrbrewer that is defiantly an interesting use-case. Without understanding more about how your code is set up, it's hard to really say if it's a bad thing to do ;)
The idea is interesting enough I thought maybe to just add it, but since this module uses a setTimeout
object under the hood, that object does not provide any way to ether (a) extend the timeout or (b) get the elapsed time it has seen, which certainly would make implement this difficult.
from timeout.
Thanks for considering. It would even be useful just to cancel the existing setTimeout()
(which is I assume what is presently possible via req.clearTimeout()
) and re-start a new setTimeout()
using a different timeout value to the one used originally. That way, when a new request comes in that I know will need a little more time, I can (before I've started really processing the request) just set up a new (longer) timeout.
from timeout.
@dougwilson any update on that? If connect-timeout
can override the default behavior, it would be very helpful.
from timeout.
I did a tiny bit of work on this a while back, but I think there was some complications and I shelved the work and forgot about it.
from timeout.
This would help me out as well. I created PR #34 that adds 3 methods.
req.setTimeout(delay)
: reset the timeout and start from now
req.addTimeout(delay)
: add to the current timeout
req.timeoutLeft()
: get the amount of milliseconds left (0 after timedout)
from timeout.
See express-timeout-handler
alternative implementation with the ability to override the timeout. 👍🏻
from timeout.
Related Issues (20)
- Can't set headers after they are sent. HOT 1
- clearer documentation HOT 4
- 'connect-timeout' is possibly misleading HOT 2
- How to change timeout response? HOT 1
- How to catch "Can't set headers after they are sent." HOT 2
- Make this configurable via middleware.json HOT 1
- ServiceUnavailableError: Response timeout HOT 2
- "Can't set headers after they are sent" error crashes the app HOT 1
- Documentation Update HOT 4
- Yarn certificate has expired. HOT 1
- What is the associate between this library and http's timeout HOT 1
- Should remove listener to timeout event HOT 7
- Turning off response timeouts HOT 2
- Make timeout action more flexible HOT 4
- Source code was not found HOT 4
- Override timeout for a route HOT 3
- req.timedout always come out to be false irrespective of timeout happens or not HOT 11
- `timedOut` instead of `timedout`?
- Upgrade Dependencies
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from timeout.