diff options
author | Gusted <williamzijl7@hotmail.com> | 2022-05-04 10:09:42 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-04 12:09:42 +0200 |
commit | 3114cd30b817692556306ce6261ace2b58c54b76 (patch) | |
tree | c26e7e748a795197c76ca93eee0013584d4f4096 /modules/context | |
parent | 9c04da37d0bcb51ef0c20baeeea48c48eda99ff0 (diff) | |
download | gitea-3114cd30b817692556306ce6261ace2b58c54b76.tar.gz gitea-3114cd30b817692556306ce6261ace2b58c54b76.zip |
Only check for non-finished migrating task (#19601)
* Only check for non-finished migrating task
- Only check if a non-finished migrating task exists for a mirror before
fetching the mirror details from the database.
- Resolves #19600
- Regression: #19588
* Clarify function
Diffstat (limited to 'modules/context')
-rw-r--r-- | modules/context/repo.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/modules/context/repo.go b/modules/context/repo.go index c5e3a69e5c..4a1e9aa9e8 100644 --- a/modules/context/repo.go +++ b/modules/context/repo.go @@ -371,14 +371,14 @@ func repoAssignment(ctx *Context, repo *repo_model.Repository) { if repo.IsMirror { - // Check if there's a migrating task. - // If it does exist, don't fetch the Mirror from the database as it doesn't exist yet. - hasTask, err := models.HasMigratingTask(repo.ID) + // Check if the mirror has finsihed migrationg, only then we can + // lookup the mirror informtation the database. + finishedMigrating, err := models.HasFinishedMigratingTask(repo.ID) if err != nil { - ctx.ServerError("GetMirrorByRepoID", err) + ctx.ServerError("HasFinishedMigratingTask", err) return } - if !hasTask { + if finishedMigrating { ctx.Repo.Mirror, err = repo_model.GetMirrorByRepoID(repo.ID) if err != nil { ctx.ServerError("GetMirrorByRepoID", err) |