From e93e29822d513e866968e90d8e1093cb5e689054 Mon Sep 17 00:00:00 2001 From: yp05327 <576951401@qq.com> Date: Tue, 26 Mar 2024 19:20:26 +0900 Subject: [PATCH] Fix duplicate migrated milestones (#30102) Fix #17567 (cherry picked from commit 274bc00ca2c3bf5a734d74e47cc28fa8c41e3875) --- services/migrations/migrate.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/services/migrations/migrate.go b/services/migrations/migrate.go index ae164a7add..367818c0e7 100644 --- a/services/migrations/migrate.go +++ b/services/migrations/migrate.go @@ -257,14 +257,13 @@ func migrateRepository(ctx context.Context, doer *user_model.User, downloader ba } log.Warn("migrating milestones is not supported, ignored") } - msBatchSize := uploader.MaxBatchInsertSize("milestone") for len(milestones) > 0 { if len(milestones) < msBatchSize { msBatchSize = len(milestones) } - if err := uploader.CreateMilestones(milestones...); err != nil { + if err := uploader.CreateMilestones(milestones[:msBatchSize]...); err != nil { return err } milestones = milestones[msBatchSize:]