1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-01-19 08:19:15 +08:00

feat: 升级时暂停计划任务 (#2274)

This commit is contained in:
ssongliu 2023-09-13 15:54:12 +08:00 committed by GitHub
parent 65662b2e84
commit 7b4b0bddff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -104,6 +104,10 @@ func (u *UpgradeService) Upgrade(req dto.Upgrade) error {
fileName := fmt.Sprintf("1panel-%s-%s-%s.tar.gz", req.Version, "linux", itemArch)
_ = settingRepo.Update("SystemStatus", "Upgrading")
go func() {
_ = global.Cron.Stop()
defer func() {
global.Cron.Start()
}()
if err := fileOp.DownloadFile(downloadPath+"/"+fileName, rootDir+"/"+fileName); err != nil {
global.LOG.Errorf("download service file failed, err: %v", err)
_ = settingRepo.Update("SystemStatus", "Free")

View File

@ -2,10 +2,11 @@ package migrations
import (
"fmt"
"github.com/1Panel-dev/1Panel/backend/app/service"
"strings"
"time"
"github.com/1Panel-dev/1Panel/backend/app/service"
"github.com/1Panel-dev/1Panel/backend/app/model"
"github.com/1Panel-dev/1Panel/backend/app/repo"
"github.com/1Panel-dev/1Panel/backend/constant"
@ -705,6 +706,7 @@ var UpdateDatabase = &gormigrate.Migration{
"app_install_id": mysqlInfo.ID,
"name": mysqlInfo.Name,
"password": pass,
"port": service.DatabaseKeys["mysql"],
"address": mysqlInfo.ServiceName,
}).Error; err != nil {
global.LOG.Errorf("updata database %s info failed, err: %v", data.Name, err)