diff --git a/content/en/docs/hertz/tutorials/basic-feature/graceful-shutdown.md b/content/en/docs/hertz/tutorials/basic-feature/graceful-shutdown.md index 8be49585738..ca5e827d5aa 100644 --- a/content/en/docs/hertz/tutorials/basic-feature/graceful-shutdown.md +++ b/content/en/docs/hertz/tutorials/basic-feature/graceful-shutdown.md @@ -27,9 +27,15 @@ h.Engine.OnShutdown = append(h.Engine.OnShutdown, shutDownFunc) `waitSignal` is default implementation for signal waiter,which is executed as follows: +Version **< v0.9.6** + - SIGTERM triggers immediately close. - SIGHUP|SIGINT triggers graceful shutdown. +Version **>= v0.9.6** + +- SIGTERM|SIGHUP|SIGINT triggers graceful shutdown. + If Default one is not met the requirement, `SetCustomSignalWaiter` set this function to customize. ```go diff --git a/content/zh/docs/hertz/tutorials/basic-feature/graceful-shutdown.md b/content/zh/docs/hertz/tutorials/basic-feature/graceful-shutdown.md index 725ed7892cc..29601fa3053 100644 --- a/content/zh/docs/hertz/tutorials/basic-feature/graceful-shutdown.md +++ b/content/zh/docs/hertz/tutorials/basic-feature/graceful-shutdown.md @@ -14,8 +14,8 @@ Hertz 支持优雅退出,优雅退出过程如下: 4. 关闭网络库的信号监听 5. 对处于关闭过程中的请求回包统一带上 `Connection:Close` header 6. `Select` 等待业务协程退出: - 1. 对于 netpoll 网络库,开启默认 1s(netpoll 中设置,暂时不可更改)的 `ticker`,定时查看 `active conn`(业务 handle 退出且连接不处于阻塞读状态)是否为 0;对于 go net 网络库,则关闭监听,不对连接做处理。 - 2. 等待超时时间为 `ExitWaitTime` 的 context 触发,默认 5s + 1. 对于 netpoll 网络库,开启默认 1s(netpoll 中设置,暂时不可更改)的 `ticker`,定时查看 `active conn`(业务 handle 退出且连接不处于阻塞读状态)是否为 0;对于 go net 网络库,则关闭监听,不对连接做处理。 + 2. 等待超时时间为 `ExitWaitTime` 的 context 触发,默认 5s 如需修改等待超时时间,可通过 `server.WithExitWaitTime()` 进行配置。 @@ -27,9 +27,15 @@ h.Engine.OnShutdown = append(h.Engine.OnShutdown, shutDownFunc) Hertz 使用 `waitSignal` 函数作为信号处理的默认实现方式,处理如下: +版本 **< v0.9.6** + - 当接收到 `SIGTERM` 系统信号时触发立即退出。 - 当接收到 `SIGHUP|SIGINT` 系统信号时触发优雅退出。 +版本 **>= v0.9.6** + +- 当接收到 `SIGTERM|SIGHUP|SIGINT` 系统信号时触发优雅退出。 + 当信号处理的默认实现方式无法满足需求时,可通过 `SetCustomSignalWaiter` 来自定义信号处理方式。 ```go