@@ -1209,26 +1209,20 @@ func upApp(task *task.Task, appInstall *model.AppInstall, pullImages, useLifecyc
12091209 task .LogSuccess (logStr )
12101210 return
12111211 }
1212- exist , _ := appInstallRepo .GetFirst (repo .WithByID (appInstall .ID ))
1213- if exist .ID > 0 {
1214- containerNames , err := getContainerNames (* appInstall )
1215- if err == nil {
1216- if len (containerNames ) > 0 {
1217- appInstall .ContainerName = strings .Join (containerNames , "," )
1218- }
1219- _ = appInstallRepo .Save (context .Background (), appInstall )
1220- }
1212+ if containerNames , err := getContainerNames (* appInstall ); err == nil && len (containerNames ) > 0 {
1213+ appInstall .ContainerName = strings .Join (containerNames , "," )
1214+ _ = appInstallRepo .BatchUpdateBy (map [string ]interface {}{"container_name" : appInstall .ContainerName }, repo .WithByID (appInstall .ID ))
12211215 }
12221216 if err := upProject (appInstall ); err != nil {
12231217 if appInstall .Message == "" {
12241218 appInstall .Message = err .Error ()
12251219 }
12261220 appInstall .Status = constant .StatusUpErr
1227- _ = appInstallRepo .Save ( context . Background (), appInstall )
1221+ _ = appInstallRepo .UpdateStatus ( appInstall , false )
12281222 return err
12291223 } else {
12301224 appInstall .Status = constant .StatusRunning
1231- _ = appInstallRepo .Save ( context . Background (), appInstall )
1225+ _ = appInstallRepo .UpdateStatus ( appInstall , false )
12321226 return nil
12331227 }
12341228}
@@ -1525,11 +1519,7 @@ func synAppInstall(containers map[string]container.Summary, appInstall *model.Ap
15251519 }
15261520 appInstall .Status = constant .StatusError
15271521 appInstall .Message = buserr .WithName ("ErrContainerNotFound" , strings .Join (containerNames , "," )).Error ()
1528- if appInstall .App .Key == "ollama" || appInstall .App .Key == "vllm" {
1529- _ = appInstallRepo .UpdateStatus (appInstall )
1530- } else {
1531- _ = appInstallRepo .Save (context .Background (), appInstall )
1532- }
1522+ _ = appInstallRepo .UpdateStatus (appInstall , true )
15331523 return
15341524 }
15351525 notFoundNames := make ([]string , 0 )
@@ -1588,11 +1578,7 @@ func synAppInstall(containers map[string]container.Summary, appInstall *model.Ap
15881578 appInstall .Message = msg
15891579 appInstall .Status = constant .StatusUnHealthy
15901580 }
1591- if appInstall .App .Key == "ollama" || appInstall .App .Key == "vllm" {
1592- _ = appInstallRepo .UpdateStatus (appInstall )
1593- } else {
1594- _ = appInstallRepo .Save (context .Background (), appInstall )
1595- }
1581+ _ = appInstallRepo .UpdateStatus (appInstall , true )
15961582}
15971583
15981584func handleInstalled (appInstallList []model.AppInstall , updated , sync , checkUpdate bool ) ([]response.AppInstallDTO , error ) {
0 commit comments