392 Star 2.7K Fork 650

GVPJohn/gf

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
ghttp_server_admin_unix.go 1.04 KB
一键复制 编辑 原始数据 按行查看 历史
// Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
//
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file,
// You can obtain one at https://github.com/gogf/gf.
//go:build !windows
// +build !windows
package ghttp
import (
"context"
"os"
"syscall"
"github.com/gogf/gf/v2/internal/intlog"
"github.com/gogf/gf/v2/os/glog"
"github.com/gogf/gf/v2/os/gproc"
)
// handleProcessSignal handles all signals from system in blocking way.
func handleProcessSignal() {
var ctx = context.TODO()
gproc.AddSigHandlerShutdown(func(sig os.Signal) {
shutdownWebServersGracefully(ctx, sig)
})
gproc.AddSigHandler(func(sig os.Signal) {
// If the graceful restart feature is not enabled,
// it does nothing except printing a warning log.
if !gracefulEnabled {
glog.Warning(ctx, "graceful reload feature is disabled")
return
}
if err := restartWebServers(ctx, sig, ""); err != nil {
intlog.Errorf(ctx, `%+v`, err)
}
}, syscall.SIGUSR1)
gproc.Listen()
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/johng/gf.git
git@gitee.com:johng/gf.git
johng
gf
gf
master

搜索帮助