fix: Fix the problem of abnormal synchronization of the script library (#8631)

This commit is contained in:
ssongliu 2025-05-14 14:09:54 +08:00 committed by GitHub
parent 0941b0aad3
commit c9f8c93083
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -199,7 +199,6 @@ func (u *ScriptService) Sync(req dto.OperateByTaskID) error {
if err != nil {
return fmt.Errorf("load scripts data.yaml from remote failed, err: %v", err)
}
fmt.Println(string(dataRes))
syncTask.Log("download successful!")
var scripts Scripts
@ -243,6 +242,11 @@ func (u *ScriptService) Sync(req dto.OperateByTaskID) error {
if err := global.DB.Model(&model.Setting{}).Where("key = ?", "ScriptVersion").Updates(map[string]interface{}{"value": string(versionRes)}).Error; err != nil {
return fmt.Errorf("update script version in db failed, err: %v", err)
}
go func() {
if err := xpack.Sync(constant.SyncScripts); err != nil {
global.LOG.Errorf("sync scripts to node failed, err: %v", err)
}
}()
return nil
}, nil)