From b29081a67edba55ea3c778d50c7801cf20f8d92d Mon Sep 17 00:00:00 2001 From: ambition <39669748+Ambition9186@users.noreply.github.com> Date: Sun, 29 Sep 2024 10:07:20 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=89=B9=E9=87=8F?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=E8=BF=87=E5=A4=9A=E6=96=87=E4=BB=B6=E6=97=B6?= =?UTF-8?q?=E6=8A=A5=E9=94=99=20(#3541)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bcs-services/bcs-bscp/pkg/dal/dao/commit.go | 2 +- bcs-services/bcs-bscp/pkg/dal/dao/config_item.go | 2 +- bcs-services/bcs-bscp/pkg/dal/dao/content.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) 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