0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-15 04:30:25 +00:00

Add timeout to cowboy_loop

LH: I have added a test that does both hibernate and timeout
    and fixed a related issue. I also tweaked the docs and tests.
This commit is contained in:
jdamanalo 2023-03-09 15:54:41 +08:00 committed by Loïc Hoguin
parent a72bf4105f
commit a81dc8af9d
No known key found for this signature in database
GPG key ID: 8A9DF795F6FED764
8 changed files with 165 additions and 25 deletions

View file

@ -28,11 +28,11 @@ Loop handlers implement the following interface:
----
init(Req, State)
-> {cowboy_loop, Req, State}
| {cowboy_loop, Req, State, hibernate}
| {cowboy_loop, Req, State, hibernate | timeout()}
info(Info, Req, State)
-> {ok, Req, State}
| {ok, Req, State, hibernate}
| {ok, Req, State, hibernate | timeout()}
| {stop, Req, State}
terminate(Reason, Req, State) -> ok %% optional
@ -69,7 +69,9 @@ stop::
== Changelog
* *2.0*: Loop handlers no longer need to handle overflow/timeouts.
* *2.11*: A timeout may be returned instead of `hibernate`.
It functions the same way as the `gen_server` timeout.
* *2.0*: Loop handlers no longer need to handle socket events.
* *1.0*: Behavior introduced.
== See also