A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.
Revert "perf: optimize tag has new tag check"
Sonuie0957c0a0d17
diff --git a/internal/service/tag_common/tag_common.go b/internal/service/tag_common/tag_common.goindex e5c136c3..d99795d9 100644--- a/internal/service/tag_common/tag_common.go+++ b/internal/service/tag_common/tag_common.go@@ -291,18 +291,24 @@ func (ts *TagCommonService) ExistRecommend(ctx context.Context, tags []*schema.Tfunc (ts *TagCommonService) HasNewTag(ctx context.Context, tags []*schema.TagItem) (bool, error) {tagNames := make([]string, 0)- tagMap := make(map[string]struct{})+ tagMap := make(map[string]bool)for _, item := range tags {item.SlugName = strings.ReplaceAll(item.SlugName, " ", "-")tagNames = append(tagNames, item.SlugName)- tagMap[item.SlugName] = struct{}{}+ tagMap[item.SlugName] = false}list, err := ts.GetTagListByNames(ctx, tagNames)if err != nil {return true, err}for _, item := range list {- if _, ok := tagMap[item.SlugName]; !ok {+ _, ok := tagMap[item.SlugName]+ if ok {+ tagMap[item.SlugName] = true+ }+ }+ for _, has := range tagMap {+ if !has {return true, nil}}