소스 검색

fix: install tasks

Yeuoly 7 달 전
부모
커밋
ae970a6c91
1개의 변경된 파일5개의 추가작업 그리고 7개의 파일을 삭제
  1. 5 7
      internal/service/install_plugin.go

+ 5 - 7
internal/service/install_plugin.go

@@ -170,17 +170,15 @@ func InstallPluginRuntimeToTenant(
 						}
 					}
 
-					// delete the task if all plugins are installed successfully,
-					// otherwise update the task status
 					if successes == len(taskPointer.Plugins) {
+						// update status
+						taskPointer.Status = models.InstallTaskStatusSuccess
+						// delete the task after 120 seconds without transaction
 						time.AfterFunc(120*time.Second, func() {
-							db.Delete(taskPointer, tx)
+							db.Delete(taskPointer)
 						})
-					} else {
-						return db.Update(taskPointer, tx)
 					}
-
-					return nil
+					return db.Update(taskPointer, tx)
 				}); err != nil {
 					log.Error("failed to update install task status %s", err.Error())
 				}