0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-12-22 10:14:05 +01:00

Fix duplicate migrated milestones (#30102)

Fix #17567
This commit is contained in:
yp05327 2024-03-26 19:20:26 +09:00 committed by GitHub
parent c1ac721508
commit 274bc00ca2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -250,14 +250,13 @@ func migrateRepository(ctx context.Context, doer *user_model.User, downloader ba
} }
log.Warn("migrating milestones is not supported, ignored") log.Warn("migrating milestones is not supported, ignored")
} }
msBatchSize := uploader.MaxBatchInsertSize("milestone") msBatchSize := uploader.MaxBatchInsertSize("milestone")
for len(milestones) > 0 { for len(milestones) > 0 {
if len(milestones) < msBatchSize { if len(milestones) < msBatchSize {
msBatchSize = len(milestones) msBatchSize = len(milestones)
} }
if err := uploader.CreateMilestones(milestones...); err != nil { if err := uploader.CreateMilestones(milestones[:msBatchSize]...); err != nil {
return err return err
} }
milestones = milestones[msBatchSize:] milestones = milestones[msBatchSize:]