feat(deploy): 在线更新 - 新增后台检查、强制备份迁移与失败自动回退

This commit is contained in:
ddCat committed 2026-08-30 22:15:17 +08:00
1 parent 8227921c68
commit 694cb974fb
60 files changed
+4124 -93

No files matched your search

+12 -6
View File
@@ -1,6 +1,7 @@
package service
import (
"context"
"encoding/json"
"errors"
"log"
@@ -156,18 +157,23 @@ func taskResultText(raw string) string {
return result.Text
}
func (s *Service) startTextReplayCleanup() {
func (s *Service) startTextReplayCleanup(ctx context.Context) {
cleanup := func() {
if _, err := s.CleanupTaskTextReplay(); err != nil {
log.Printf("text replay cleanup failed: %v", err)
}
}
cleanup()
go func() {
s.runWorkerLoop(func(ctx context.Context) {
cleanup()
ticker := time.NewTicker(time.Hour)
defer ticker.Stop()
for range ticker.C {
cleanup()
for {
select {
case <-ctx.Done():
return
case <-ticker.C:
cleanup()
}
}
}()
})
}