feat(app): 实现优雅停机功能
- 新增 shuttingDown 原子布尔标志和 shutdownOnce 保证单次执行 - 添加 DrainTimeout 和 ShutdownTimeout 配置参数,默认 5s 和 30s - 修改 ServeHTTP 拦截新请求返回 503 Service Unavailable - 实现跨平台信号处理:Windows 关窗口和 Linux SIGTERM/SIGINT - 添加 recover 保护避免停机过程中 panic 触发重启 - 优化 HTTP 服务退出判断,排除正常关闭情况 - 新增 log.LoggerNoCaller 用于访问日志等无意义调用方场景 - 更新 README 文档增加优雅停机特性说明和文档链接 - 创建详细的优雅停机文档和测试用例 - 添加 Windows 平台特定信号处理实现 - 新增 .cursor 计划文件记录开发方案
This commit is contained in:
+2
-2
@@ -669,7 +669,7 @@ func (that *MakeCode) Db2JSON(db *db.HoTimeDB, config Map) {
|
||||
if err != nil {
|
||||
that.Log.Error().Err(err).Msg("写入 configDB 文件失败")
|
||||
}
|
||||
that.Log.Warnf("新建 configDB: %s", config.GetString("configDB"))
|
||||
that.Log.Infof("新建 configDB: %s", config.GetString("configDB"))
|
||||
|
||||
}
|
||||
|
||||
@@ -685,7 +685,7 @@ func (that *MakeCode) Db2JSON(db *db.HoTimeDB, config Map) {
|
||||
if err != nil {
|
||||
that.Log.Error().Err(err).Msg("写入 config 文件失败")
|
||||
}
|
||||
that.Log.Warnf("新建 config: %s", config.GetString("config"))
|
||||
that.Log.Infof("新建 config: %s", config.GetString("config"))
|
||||
|
||||
}
|
||||
//fmt.Println("有新的代码生成,请重新运行")
|
||||
|
||||
Reference in New Issue
Block a user