aboutsummaryrefslogtreecommitdiffstats
path: root/models/task.go
diff options
context:
space:
mode:
authorGusted <williamzijl7@hotmail.com>2022-05-03 13:55:17 +0000
committerGitHub <noreply@github.com>2022-05-03 16:55:17 +0300
commit982b726b0829686cc49543c6aee696a4b24d833f (patch)
tree99e9ed4f7d33885915c6e59560c374f60f6fbdd0 /models/task.go
parentb7abb31b7baeb2ee60d28b90354af3bef7f7a74a (diff)
downloadgitea-982b726b0829686cc49543c6aee696a4b24d833f.tar.gz
gitea-982b726b0829686cc49543c6aee696a4b24d833f.zip
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>
Diffstat (limited to 'models/task.go')
-rw-r--r--models/task.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/models/task.go b/models/task.go
index bade1a639d..0720d28610 100644
--- a/models/task.go
+++ b/models/task.go
@@ -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{