Skip to content

Commit

Permalink
fix: 修复批量导入过多文件时报错 (#3541)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ambition9186 committed Sep 29, 2024
1 parent c935cd2 commit b29081a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bcs-services/bcs-bscp/pkg/dal/dao/commit.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion bcs-services/bcs-bscp/pkg/dal/dao/config_item.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion bcs-services/bcs-bscp/pkg/dal/dao/content.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b29081a

Please sign in to comment.