From 706ff7aa9fcfe4c43893dc12e27d064064e80635 Mon Sep 17 00:00:00 2001 From: yp05327 <576951401@qq.com> Date: Tue, 26 Mar 2024 21:58:56 +0900 Subject: [PATCH] Fix duplicate migrated milestones (#30102) (#30105) backport #30102 (cherry picked from commit a0f89ba8c76dd77990f73151cf60e9b945c31587) --- 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 0b83f3b4a3..5bb3056161 100644 --- a/services/migrations/migrate.go +++ b/services/migrations/migrate.go @@ -250,14 +250,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:]