Don't fetch Mirror when it's migrating (#19588)

- When a repository is still being migrated, don't try to fetch the
Mirror from the database. Instead skip it. This allows to visit
repositories that are still being migrated and were configured to be
mirrored.
- Resolves #19585
- Regression: #19295

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
Gustedandwxiaoguang authored and GitHub committed 2022-05-03 16:55:17 +03:00
1 parent b7abb31b7b
commit 982b726b08
2 files changed
+22 -5

No files matched your search

+8
View File
@@ -181,6 +181,14 @@ func GetMigratingTask(repoID int64) (*Task, error) {
return &task, nil
}
// HasMigratingTask returns if migrating task exist for repo.
func HasMigratingTask(repoID int64) (bool, error) {
return db.GetEngine(db.DefaultContext).Exist(&Task{
RepoID: repoID,
Type: structs.TaskTypeMigrateRepo,
})
}
// GetMigratingTaskByID returns the migrating task by repo's id
func GetMigratingTaskByID(id, doerID int64) (*Task, *migration.MigrateOptions, error) {
task := Task{