diff --git a/backend/app/service/app.go b/backend/app/service/app.go index c8babd0a8..4c9b4697a 100644 --- a/backend/app/service/app.go +++ b/backend/app/service/app.go @@ -91,10 +91,6 @@ func (a AppService) PageApp(req request.AppSearch) (interface{}, error) { } var appDTOs []*response.AppDto for _, ap := range apps { - // ap.ReadMe = "" - // ap.Website = "" - // ap.Document = "" - // ap.Github = "" appDTO := &response.AppDto{ ID: ap.ID, Name: ap.Name, @@ -816,6 +812,14 @@ func (a AppService) SyncAppListFromRemote() (err error) { } settingService := NewISettingService() _ = settingService.Update("AppStoreSyncStatus", constant.Syncing) + + defer func() { + if err != nil { + _ = settingService.Update("AppStoreSyncStatus", constant.SyncFailed) + global.LOG.Errorf("App Store synchronization failed %v", err) + } + }() + setting, err := settingService.GetSettingInfo() if err != nil { return err diff --git a/backend/app/service/app_utils.go b/backend/app/service/app_utils.go index 6ccc33889..ef70e974c 100644 --- a/backend/app/service/app_utils.go +++ b/backend/app/service/app_utils.go @@ -584,7 +584,7 @@ func upgradeInstall(req request.AppInstallUpgrade) error { _ = appDetailRepo.Update(context.Background(), detail) } go func() { - _, _, _ = httpUtil.HandleGet(detail.DownloadCallBackUrl, http.MethodGet, constant.TimeOut5s) + RequestDownloadCallBack(detail.DownloadCallBackUrl) }() } @@ -822,7 +822,7 @@ func copyData(app model.App, appDetail model.AppDetail, appInstall *model.AppIns return } go func() { - _, _, _ = httpUtil.HandleGet(appDetail.DownloadCallBackUrl, http.MethodGet, constant.TimeOut5s) + RequestDownloadCallBack(appDetail.DownloadCallBackUrl) }() } appKey := app.Key @@ -1580,3 +1580,10 @@ func isHostModel(dockerCompose string) bool { } return false } + +func RequestDownloadCallBack(downloadCallBackUrl string) { + if downloadCallBackUrl == "" { + return + } + _, _, _ = httpUtil.HandleGet(downloadCallBackUrl, http.MethodGet, constant.TimeOut5s) +} diff --git a/backend/app/service/runtime_utils.go b/backend/app/service/runtime_utils.go index 72640f5ea..43f0f2ee3 100644 --- a/backend/app/service/runtime_utils.go +++ b/backend/app/service/runtime_utils.go @@ -5,7 +5,6 @@ import ( "context" "fmt" "io" - "net/http" "os" "os/exec" "path" @@ -20,7 +19,6 @@ import ( "github.com/1Panel-dev/1Panel/backend/global" "github.com/1Panel-dev/1Panel/backend/utils/docker" "github.com/1Panel-dev/1Panel/backend/utils/files" - httpUtil "github.com/1Panel-dev/1Panel/backend/utils/http" "github.com/pkg/errors" "github.com/subosito/gotenv" "gopkg.in/yaml.v3" @@ -56,10 +54,7 @@ func handleNodeAndJava(create request.RuntimeCreate, runtime *model.Runtime, fil } go func() { - if _, _, err := httpUtil.HandleGet(nodeDetail.DownloadCallBackUrl, http.MethodGet, constant.TimeOut5s); err != nil { - global.LOG.Errorf("http request failed(handleNode), err: %v", err) - return - } + RequestDownloadCallBack(nodeDetail.DownloadCallBackUrl) }() go startRuntime(runtime) diff --git a/backend/constant/app.go b/backend/constant/app.go index 9a6f5c825..183128736 100644 --- a/backend/constant/app.go +++ b/backend/constant/app.go @@ -14,6 +14,7 @@ const ( SyncSuccess = "SyncSuccess" Paused = "Paused" UpErr = "UpErr" + SyncFailed = "SyncFailed" ContainerPrefix = "1Panel-"