forked from forgejo/forgejo
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
This commit is contained in:
parent
9c04da37d0
commit
3114cd30b8
2 changed files with 11 additions and 11 deletions
|
@ -181,12 +181,12 @@ 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,
|
||||
})
|
||||
// HasFinishedMigratingTask returns if a finished migration task exists for the repo.
|
||||
func HasFinishedMigratingTask(repoID int64) (bool, error) {
|
||||
return db.GetEngine(db.DefaultContext).
|
||||
Where("repo_id=? AND type=? AND status=?", repoID, structs.TaskTypeMigrateRepo, structs.TaskStatusFinished).
|
||||
Table("task").
|
||||
Exist()
|
||||
}
|
||||
|
||||
// GetMigratingTaskByID returns the migrating task by repo's id
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue