Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only check for non-finished migrating task #19601

Merged
merged 3 commits into from
May 4, 2022

Conversation

Gusted
Copy link
Contributor

@Gusted Gusted commented May 3, 2022

- Only check if a non-finished migrating task exists for a mirror before
fetching the mirror details from the database.
- Resolves go-gitea#19600
- Regression: go-gitea#19588
@Gusted Gusted added this to the 1.17.0 milestone May 3, 2022
@Gusted Gusted added issue/regression Issue needs no code to be fixed, only a description on how to fix it yourself skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features. labels May 3, 2022
models/task.go Outdated Show resolved Hide resolved
models/task.go Outdated Show resolved Hide resolved
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels May 4, 2022
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels May 4, 2022
// 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).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Where("repo_id=? AND type=? AND status=?", repoID, structs.TaskTypeMigrateRepo, structs.TaskStatusFinished).
Where("repo_id=? AND type=? AND status<>?", repoID, structs.TaskTypeMigrateRepo, structs.TaskStatusRunning).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or how should failed migrations be handled?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Failed migrations don't have a any information in the Mirror table.

@6543 6543 merged commit 3114cd3 into go-gitea:main May 4, 2022
@Gusted Gusted deleted the fix-mirrored-repo-settings branch May 4, 2022 11:32
zjjhot added a commit to zjjhot/gitea that referenced this pull request May 4, 2022
* giteaofficial/main:
  Add health check endpoint (go-gitea#18465)
  Only check for non-finished migrating task (go-gitea#19601)
  Make .cs highlighting legible on dark themes. (go-gitea#19604)
AbdulrhmnGhanem pushed a commit to kitspace/gitea that referenced this pull request Aug 24, 2022
* 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 go-gitea#19600
- Regression: go-gitea#19588

* Clarify function
@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/regression Issue needs no code to be fixed, only a description on how to fix it yourself lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

500 Internal Server Error when accessing settings for mirror
5 participants