diff --git a/bcs-services/bcs-bscp/pkg/dal/dao/commit.go b/bcs-services/bcs-bscp/pkg/dal/dao/commit.go index cdf2c7c646..82d33bfd87 100644 --- a/bcs-services/bcs-bscp/pkg/dal/dao/commit.go +++ b/bcs-services/bcs-bscp/pkg/dal/dao/commit.go @@ -168,7 +168,7 @@ func (dao *commitDao) BatchCreateWithTx(kit *kit.Kit, tx *gen.QueryTx, commits [ } commit.ID = ids[i] } - return tx.Query.Commit.WithContext(kit.Ctx).Save(commits...) + return tx.Query.Commit.WithContext(kit.Ctx).CreateInBatches(commits, 500) } // BatchListLatestCommits batch list config items' latest commit. diff --git a/bcs-services/bcs-bscp/pkg/dal/dao/config_item.go b/bcs-services/bcs-bscp/pkg/dal/dao/config_item.go index 7dd3bc3bc9..87d43ba859 100644 --- a/bcs-services/bcs-bscp/pkg/dal/dao/config_item.go +++ b/bcs-services/bcs-bscp/pkg/dal/dao/config_item.go @@ -264,7 +264,7 @@ func (dao *configItemDao) BatchCreateWithTx(kit *kit.Kit, tx *gen.QueryTx, } configItem.ID = ids[i] } - if err := tx.ConfigItem.WithContext(kit.Ctx).Save(configItems...); err != nil { + if err := tx.ConfigItem.WithContext(kit.Ctx).CreateInBatches(configItems, 500); err != nil { return err } return nil diff --git a/bcs-services/bcs-bscp/pkg/dal/dao/content.go b/bcs-services/bcs-bscp/pkg/dal/dao/content.go index b6518b5ee8..19ca11fc29 100644 --- a/bcs-services/bcs-bscp/pkg/dal/dao/content.go +++ b/bcs-services/bcs-bscp/pkg/dal/dao/content.go @@ -149,7 +149,7 @@ func (dao *contentDao) BatchCreateWithTx(kit *kit.Kit, tx *gen.QueryTx, contents } content.ID = ids[i] } - if err := tx.Content.WithContext(kit.Ctx).Save(contents...); err != nil { + if err := tx.Content.WithContext(kit.Ctx).CreateInBatches(contents, 500); err != nil { return err } return nil