完善资源关闭逻辑,添加数据库和Redis连接的退出处理
This commit is contained in:
@@ -65,4 +65,14 @@ func main() {
|
||||
slog.Error("Server error", slog.Any("err", err))
|
||||
}
|
||||
}
|
||||
|
||||
// 关闭资源
|
||||
err = orm.Exit()
|
||||
if err != nil {
|
||||
slog.Error("Failed to close database connection", slog.Any("err", err))
|
||||
}
|
||||
err = rds.Exit()
|
||||
if err != nil {
|
||||
slog.Error("Failed to close redis connection", slog.Any("err", err))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user