From 7dc98096a55504a4199a666a10e3dcf8c76f52ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=97=E5=AD=90?= Date: Thu, 2 Jan 2025 21:21:27 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=9D=A2=E6=9D=BF=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/job/panel_task.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/internal/job/panel_task.go b/internal/job/panel_task.go index fee6f49793..6d24ce5e78 100644 --- a/internal/job/panel_task.go +++ b/internal/job/panel_task.go @@ -44,10 +44,12 @@ func (r *PanelTask) Run() { if err := r.db.Exec("VACUUM").Error; err != nil { app.Status = app.StatusFailed r.log.Warn("[Panel Task] failed to vacuum database", slog.Any("err", err)) + return } if err := r.db.Exec("PRAGMA wal_checkpoint(TRUNCATE);").Error; err != nil { app.Status = app.StatusFailed r.log.Warn("[Panel Task] failed to wal checkpoint database", slog.Any("err", err)) + return } // 备份面板 @@ -62,6 +64,7 @@ func (r *PanelTask) Run() { } } + // 非离线模式下任务 if offline, err := r.settingRepo.GetBool(biz.SettingKeyOfflineMode); err == nil && !offline { r.updateApps() r.updateRewrites() @@ -103,15 +106,15 @@ func (r *PanelTask) updatePanel() { if err != nil { return } - old, err := version.NewVersion(app.Version) + current, err := version.NewVersion(app.Version) if err != nil { return } - current, err := version.NewVersion(panel.Version) + latest, err := version.NewVersion(panel.Version) if err != nil { return } - if !current.GreaterThan(old) { + if current.GreaterThanOrEqual(latest) { return } if download := collect.First(panel.Downloads); download != nil {