Add a heartbeat mechanism, and timeouts support #53
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Some reverse proxies kill connections after a (short) period of inactivity. Also, sometimes it's necessary to kill connections after some time to cleanup the memory.
This PR introduces new environment variables to start a heartbeat mechanism (that will prevent reverse proxies and some old browsers to kill the connection), and as well as read and write timeouts.
They are all disabled by default.
HEARTBEAT_INTERVAL
: interval between heartbeats (useful with some proxies, and old browsers), set to0s
to disable (default), example15s
READ_TIMEOUT
: maximum duration for reading the entire request, including the body, set to0
to disable (default), example:2m
WRITE_TIMEOUT
: maximum duration before timing out writes of the response, set to0
to disable (default), example:2m