mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-10-09 15:06:37 +08:00
fix: Fix the problem of abnormal recovery of the application state (#8512)
This commit is contained in:
parent
0b581b748b
commit
8bd712d891
2 changed files with 8 additions and 1 deletions
|
@ -340,7 +340,13 @@ func snapAppImage(snap snapHelper, req dto.SnapshotCreate, targetDir string) err
|
||||||
var appInstalls []model.AppInstall
|
var appInstalls []model.AppInstall
|
||||||
_ = snap.snapAgentDB.Where("1 = 1").Find(&appInstalls).Error
|
_ = snap.snapAgentDB.Where("1 = 1").Find(&appInstalls).Error
|
||||||
for _, item := range appInstalls {
|
for _, item := range appInstalls {
|
||||||
_ = snap.snapAgentDB.Where("id = ?", item.ID).Updates(map[string]interface{}{"status": constant.StatusWaitingRestart}).Error
|
if err := snap.snapAgentDB.
|
||||||
|
Model(&model.AppInstall{}).
|
||||||
|
Where("id = ?", item.ID).
|
||||||
|
Updates(map[string]interface{}{"status": constant.StatusWaitingRestart}).
|
||||||
|
Error; err != nil {
|
||||||
|
global.LOG.Errorf("update app %s status failed, err: %v", item.Name, err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var imageList []string
|
var imageList []string
|
||||||
|
|
|
@ -170,6 +170,7 @@ func (u *UpgradeService) Upgrade(req dto.Upgrade) error {
|
||||||
global.LOG.Info("upgrade successful!")
|
global.LOG.Info("upgrade successful!")
|
||||||
go writeLogs(req.Version)
|
go writeLogs(req.Version)
|
||||||
_ = settingRepo.Update("SystemVersion", req.Version)
|
_ = settingRepo.Update("SystemVersion", req.Version)
|
||||||
|
_ = global.AgentDB.Model(&model.Setting{}).Where("key = ?", "SystemVersion").Updates(map[string]interface{}{"value": req.Version}).Error
|
||||||
global.CONF.Base.Version = req.Version
|
global.CONF.Base.Version = req.Version
|
||||||
_ = settingRepo.Update("SystemStatus", "Free")
|
_ = settingRepo.Update("SystemStatus", "Free")
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue