diff options
author | John Olheiser <42128690+jolheiser@users.noreply.github.com> | 2019-12-11 18:20:11 -0600 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2019-12-12 08:20:11 +0800 |
commit | 382936a668c48b3c83fe80cdf138f76fb74a5f8f (patch) | |
tree | 79ec4ab3342a4218d53ae246da39819b7b7952ed /modules/migrations/migrate.go | |
parent | 3bf5a07537a53c6903b39268559c5c76bee85c12 (diff) | |
download | gitea-382936a668c48b3c83fe80cdf138f76fb74a5f8f.tar.gz gitea-382936a668c48b3c83fe80cdf138f76fb74a5f8f.zip |
Add SyncTags to uploader interface (#9326)
* Add sync tags to interface
Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Fix revive
Signed-off-by: jolheiser <john.olheiser@gmail.com>
Diffstat (limited to 'modules/migrations/migrate.go')
-rw-r--r-- | modules/migrations/migrate.go | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/modules/migrations/migrate.go b/modules/migrations/migrate.go index 124ef4413f..957d4c85d0 100644 --- a/modules/migrations/migrate.go +++ b/modules/migrations/migrate.go @@ -161,20 +161,21 @@ func migrateRepository(downloader base.Downloader, uploader base.Uploader, opts } relBatchSize := uploader.MaxBatchInsertSize("release") - syncTags := false for len(releases) > 0 { - if len(releases) <= relBatchSize { - if len(releases) < relBatchSize { - relBatchSize = len(releases) - } - syncTags = true + if len(releases) < relBatchSize { + relBatchSize = len(releases) } - if err := uploader.CreateReleases(syncTags, releases[:relBatchSize]...); err != nil { + if err := uploader.CreateReleases(releases[:relBatchSize]...); err != nil { return err } releases = releases[relBatchSize:] } + + // Once all releases (if any) are inserted, sync any remaining non-release tags + if err := uploader.SyncTags(); err != nil { + return err + } } var commentBatchSize = uploader.MaxBatchInsertSize("comment") |