fix: add plugin id conflict checker (#78)

This commit is contained in:
junwen-lee
2025-07-28 14:07:03 +08:00
committed by GitHub
parent f0c339d231
commit 376e563e4f
5 changed files with 127 additions and 12 deletions

View File

@@ -60,6 +60,7 @@ import (
"github.com/coze-dev/coze-studio/backend/pkg/lang/conv"
"github.com/coze-dev/coze-studio/backend/pkg/lang/ptr"
"github.com/coze-dev/coze-studio/backend/pkg/logs"
"github.com/coze-dev/coze-studio/backend/pkg/safego"
"github.com/coze-dev/coze-studio/backend/pkg/taskgroup"
"github.com/coze-dev/coze-studio/backend/types/consts"
"github.com/coze-dev/coze-studio/backend/types/errno"
@@ -183,18 +184,19 @@ func (a *APPApplicationService) DraftProjectDelete(ctx context.Context, req *pro
logs.CtxErrorf(ctx, "publish project '%d' failed, err=%v", req.ProjectID, err)
}
err = a.deleteAPPResources(ctx, req.ProjectID)
if err != nil {
logs.CtxErrorf(ctx, "delete app '%d' resources failed, err=%v", req.ProjectID, err)
}
safego.Go(ctx, func() {
// When an app is deleted, resource deletion is currently handled as a weak dependency, meaning some resources might not be deleted, but they will be inaccessible to the user.
// TODO:: Application resources need to check the deletion status of the application
a.deleteAPPResources(ctx, req.ProjectID)
})
resp = &projectAPI.DraftProjectDeleteResponse{}
return resp, nil
}
func (a *APPApplicationService) deleteAPPResources(ctx context.Context, appID int64) (err error) {
err = plugin.PluginApplicationSVC.DeleteAPPAllPlugins(ctx, appID)
func (a *APPApplicationService) deleteAPPResources(ctx context.Context, appID int64) {
err := plugin.PluginApplicationSVC.DeleteAPPAllPlugins(ctx, appID)
if err != nil {
logs.CtxErrorf(ctx, "delete app '%d' plugins failed, err=%v", appID, err)
}
@@ -218,8 +220,6 @@ func (a *APPApplicationService) deleteAPPResources(ctx context.Context, appID in
if err != nil {
logs.CtxErrorf(ctx, "delete app '%d' workflow failed, err=%v", appID, err)
}
return nil
}
func (a *APPApplicationService) DraftProjectUpdate(ctx context.Context, req *projectAPI.DraftProjectUpdateRequest) (resp *projectAPI.DraftProjectUpdateResponse, err error) {