aboutsummaryrefslogtreecommitdiffstats
path: root/modules/doctor
diff options
context:
space:
mode:
Diffstat (limited to 'modules/doctor')
-rw-r--r--modules/doctor/checkOldArchives.go2
-rw-r--r--modules/doctor/fix16961.go2
-rw-r--r--modules/doctor/mergebase.go8
-rw-r--r--modules/doctor/misc.go12
4 files changed, 12 insertions, 12 deletions
diff --git a/modules/doctor/checkOldArchives.go b/modules/doctor/checkOldArchives.go
index 6353eaddd2..cefb3817bf 100644
--- a/modules/doctor/checkOldArchives.go
+++ b/modules/doctor/checkOldArchives.go
@@ -17,7 +17,7 @@ import (
func checkOldArchives(ctx context.Context, logger log.Logger, autofix bool) error {
numRepos := 0
numReposUpdated := 0
- err := iterateRepositories(func(repo *repo_model.Repository) error {
+ err := iterateRepositories(ctx, func(repo *repo_model.Repository) error {
if repo.IsEmpty {
return nil
}
diff --git a/modules/doctor/fix16961.go b/modules/doctor/fix16961.go
index e241838068..92c77ba80f 100644
--- a/modules/doctor/fix16961.go
+++ b/modules/doctor/fix16961.go
@@ -268,7 +268,7 @@ func fixBrokenRepoUnits16961(ctx context.Context, logger log.Logger, autofix boo
count := 0
err := db.Iterate(
- db.DefaultContext,
+ ctx,
new(RepoUnit),
builder.Gt{
"id": 0,
diff --git a/modules/doctor/mergebase.go b/modules/doctor/mergebase.go
index a655826e1c..5a780ed2a2 100644
--- a/modules/doctor/mergebase.go
+++ b/modules/doctor/mergebase.go
@@ -18,9 +18,9 @@ import (
"xorm.io/builder"
)
-func iteratePRs(repo *repo_model.Repository, each func(*repo_model.Repository, *models.PullRequest) error) error {
+func iteratePRs(ctx context.Context, repo *repo_model.Repository, each func(*repo_model.Repository, *models.PullRequest) error) error {
return db.Iterate(
- db.DefaultContext,
+ ctx,
new(models.PullRequest),
builder.Eq{"base_repo_id": repo.ID},
func(idx int, bean interface{}) error {
@@ -33,9 +33,9 @@ func checkPRMergeBase(ctx context.Context, logger log.Logger, autofix bool) erro
numRepos := 0
numPRs := 0
numPRsUpdated := 0
- err := iterateRepositories(func(repo *repo_model.Repository) error {
+ err := iterateRepositories(ctx, func(repo *repo_model.Repository) error {
numRepos++
- return iteratePRs(repo, func(repo *repo_model.Repository, pr *models.PullRequest) error {
+ return iteratePRs(ctx, repo, func(repo *repo_model.Repository, pr *models.PullRequest) error {
numPRs++
pr.BaseRepo = repo
repoPath := repo.RepoPath()
diff --git a/modules/doctor/misc.go b/modules/doctor/misc.go
index 2f6baa814d..e96890fbab 100644
--- a/modules/doctor/misc.go
+++ b/modules/doctor/misc.go
@@ -27,9 +27,9 @@ import (
"xorm.io/builder"
)
-func iterateRepositories(each func(*repo_model.Repository) error) error {
+func iterateRepositories(ctx context.Context, each func(*repo_model.Repository) error) error {
err := db.Iterate(
- db.DefaultContext,
+ ctx,
new(repo_model.Repository),
builder.Gt{"id": 0},
func(idx int, bean interface{}) error {
@@ -50,7 +50,7 @@ func checkScriptType(ctx context.Context, logger log.Logger, autofix bool) error
}
func checkHooks(ctx context.Context, logger log.Logger, autofix bool) error {
- if err := iterateRepositories(func(repo *repo_model.Repository) error {
+ if err := iterateRepositories(ctx, func(repo *repo_model.Repository) error {
results, err := repository.CheckDelegateHooks(repo.RepoPath())
if err != nil {
logger.Critical("Unable to check delegate hooks for repo %-v. ERROR: %v", repo, err)
@@ -86,7 +86,7 @@ func checkEnablePushOptions(ctx context.Context, logger log.Logger, autofix bool
numRepos := 0
numNeedUpdate := 0
- if err := iterateRepositories(func(repo *repo_model.Repository) error {
+ if err := iterateRepositories(ctx, func(repo *repo_model.Repository) error {
numRepos++
r, err := git.OpenRepositoryCtx(git.DefaultContext, repo.RepoPath())
if err != nil {
@@ -132,13 +132,13 @@ func checkDaemonExport(ctx context.Context, logger log.Logger, autofix bool) err
logger.Critical("Unable to create cache: %v", err)
return err
}
- if err := iterateRepositories(func(repo *repo_model.Repository) error {
+ if err := iterateRepositories(ctx, func(repo *repo_model.Repository) error {
numRepos++
if owner, has := cache.Get(repo.OwnerID); has {
repo.Owner = owner.(*user_model.User)
} else {
- if err := repo.GetOwner(db.DefaultContext); err != nil {
+ if err := repo.GetOwner(ctx); err != nil {
return err
}
cache.Add(repo.OwnerID, repo.Owner)