aboutsummaryrefslogtreecommitdiffstats
path: root/services/repository/check.go
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2022-03-22 23:22:54 +0800
committerGitHub <noreply@github.com>2022-03-22 16:22:54 +0100
commit7a550b3af20dad94cf468012a6b817b43b91c1ba (patch)
tree1b836eabf8e911f35d0446c0cdad053cb3572c79 /services/repository/check.go
parent2b55422cd71b0b325f054646de5cebf39b72b502 (diff)
downloadgitea-7a550b3af20dad94cf468012a6b817b43b91c1ba.tar.gz
gitea-7a550b3af20dad94cf468012a6b817b43b91c1ba.zip
Use `ctx` instead of `db.DefaultContext` in some packages(routers/services/modules) (#19163)
* Remove `db.DefaultContext` usage in routers, use `ctx` directly * Use `ctx` directly if there is one, remove some `db.DefaultContext` in `services` * Use ctx instead of db.DefaultContext for `cmd` and some `modules` packages * fix incorrect context usage
Diffstat (limited to 'services/repository/check.go')
-rw-r--r--services/repository/check.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/services/repository/check.go b/services/repository/check.go
index 6adb8479c4..6962090f84 100644
--- a/services/repository/check.go
+++ b/services/repository/check.go
@@ -27,7 +27,7 @@ func GitFsck(ctx context.Context, timeout time.Duration, args []string) error {
log.Trace("Doing: GitFsck")
if err := db.Iterate(
- db.DefaultContext,
+ ctx,
new(repo_model.Repository),
builder.Expr("id>0 AND is_fsck_enabled=?", true),
func(idx int, bean interface{}) error {
@@ -62,7 +62,7 @@ func GitGcRepos(ctx context.Context, timeout time.Duration, args ...string) erro
args = append([]string{"gc"}, args...)
if err := db.Iterate(
- db.DefaultContext,
+ ctx,
new(repo_model.Repository),
builder.Gt{"id": 0},
func(idx int, bean interface{}) error {
@@ -97,7 +97,7 @@ func GitGcRepos(ctx context.Context, timeout time.Duration, args ...string) erro
}
// Now update the size of the repository
- if err := models.UpdateRepoSize(db.DefaultContext, repo); err != nil {
+ if err := models.UpdateRepoSize(ctx, repo); err != nil {
log.Error("Updating size as part of garbage collection failed for %v. Stdout: %s\nError: %v", repo, stdout, err)
desc := fmt.Sprintf("Updating size as part of garbage collection failed for %s. Stdout: %s\nError: %v", repo.RepoPath(), stdout, err)
if err = admin_model.CreateRepositoryNotice(desc); err != nil {
@@ -119,7 +119,7 @@ func GitGcRepos(ctx context.Context, timeout time.Duration, args ...string) erro
func gatherMissingRepoRecords(ctx context.Context) ([]*repo_model.Repository, error) {
repos := make([]*repo_model.Repository, 0, 10)
if err := db.Iterate(
- db.DefaultContext,
+ ctx,
new(repo_model.Repository),
builder.Gt{"id": 0},
func(idx int, bean interface{}) error {