summaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authordelvh <dev.lh@web.de>2023-07-24 05:47:27 +0200
committerGitHub <noreply@github.com>2023-07-23 23:47:27 -0400
commitf3d41c61eb0e66aacc269508d27716425673509b (patch)
tree37990d8fbe3c7e8bac6208cde513e5bed5126232 /cmd
parent24c3bb95acfd906dc752f867615dafd170176502 (diff)
downloadgitea-f3d41c61eb0e66aacc269508d27716425673509b.tar.gz
gitea-f3d41c61eb0e66aacc269508d27716425673509b.zip
Remove `db.DefaultContext` in `routers/` and `cmd/` (#26076)
Now, the only remaining usages of `models.db.DefaultContext` are in - `modules` - `models` - `services`
Diffstat (limited to 'cmd')
-rw-r--r--cmd/admin.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/cmd/admin.go b/cmd/admin.go
index add3d67d74..ea62075093 100644
--- a/cmd/admin.go
+++ b/cmd/admin.go
@@ -5,6 +5,7 @@
package cmd
import (
+ "context"
"errors"
"fmt"
"net/url"
@@ -373,7 +374,7 @@ func runRepoSyncReleases(_ *cli.Context) error {
continue
}
- oldnum, err := getReleaseCount(repo.ID)
+ oldnum, err := getReleaseCount(ctx, repo.ID)
if err != nil {
log.Warn(" GetReleaseCountByRepoID: %v", err)
}
@@ -385,7 +386,7 @@ func runRepoSyncReleases(_ *cli.Context) error {
continue
}
- count, err = getReleaseCount(repo.ID)
+ count, err = getReleaseCount(ctx, repo.ID)
if err != nil {
log.Warn(" GetReleaseCountByRepoID: %v", err)
gitRepo.Close()
@@ -401,9 +402,9 @@ func runRepoSyncReleases(_ *cli.Context) error {
return nil
}
-func getReleaseCount(id int64) (int64, error) {
+func getReleaseCount(ctx context.Context, id int64) (int64, error) {
return repo_model.GetReleaseCountByRepoID(
- db.DefaultContext,
+ ctx,
id,
repo_model.FindReleasesOptions{
IncludeTags: true,