2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-04 09:13:49 +08:00

feat: 优化关闭数据库连接

This commit is contained in:
耗子
2025-03-12 23:08:46 +08:00
parent e7625a77a8
commit b3e3da6833
2 changed files with 3 additions and 5 deletions

View File

@@ -833,6 +833,9 @@ func (r *backupRepo) UpdatePanel(version, url, checksum string) error {
_, _ = shell.Execf("systemctl daemon-reload")
_ = io.Remove("/tmp/panel-storage.zip")
_ = io.Remove(filepath.Join(app.Root, "panel/config.example.yml"))
if sqlDB, err := r.db.DB(); err == nil {
_ = sqlDB.Close()
}
tools.RestartPanel()
return nil

View File

@@ -48,11 +48,6 @@ func (r *PanelTask) Run() {
r.log.Warn("[Panel Task] failed to vacuum database", slog.Any("err", err))
return
}
if err := r.db.Exec("PRAGMA synchronous=FULL;").Error; err != nil {
app.Status = app.StatusFailed
r.log.Warn("[Panel Task] failed to set database synchronous to FULL", slog.Any("err", err))
return
}
if err := r.db.Exec("PRAGMA journal_mode=WAL;").Error; err != nil {
app.Status = app.StatusFailed
r.log.Warn("[Panel Task] failed to set database journal_mode to WAL", slog.Any("err", err))