diff options
author | Loïc Hoguin <[email protected]> | 2025-01-08 13:23:19 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2025-01-15 13:31:19 +0100 |
commit | 086f60cca45b2ebc1a8181545d64461436791dcc (patch) | |
tree | 48ba1fcb11164d032ce757bd3541660f79c105a4 /doc | |
parent | 643b335ba85e018a14c62cbac94306a371b62d34 (diff) | |
download | cowboy-086f60cca45b2ebc1a8181545d64461436791dcc.tar.gz cowboy-086f60cca45b2ebc1a8181545d64461436791dcc.tar.bz2 cowboy-086f60cca45b2ebc1a8181545d64461436791dcc.zip |
Avoid resetting Websocket idle_timeout timer too often
`perf` has shown that Cowboy spends a lot of time
cancelling and starting this timer. Instead of resetting
for every data received, we now only reset a field in the
state.
Before it was working like this:
- start idle timeout timer
- on trigger, close the connection
- on data, cancel and start again
Now it's working like this:
- start idle timeout timer for a tenth of its duration, with tick number = 0
- on trigger, if tick number != 10
- start the timer again, again for a tenth of its duration
- increment tick number
- on trigger, if tick number = 10
- close the connection
- on data, set tick number to 0
Diffstat (limited to 'doc')
0 files changed, 0 insertions, 0 deletions