diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2022-05-20 22:08:52 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-20 22:08:52 +0800 |
commit | fd7d83ace60258acf7139c4c787aa8af75b7ba8c (patch) | |
tree | 50038348ec10485f72344f3ac80324e04abc1283 /models/repo/repo_list.go | |
parent | d81e31ad7826a81fc7139f329f250594610a274b (diff) | |
download | gitea-fd7d83ace60258acf7139c4c787aa8af75b7ba8c.tar.gz gitea-fd7d83ace60258acf7139c4c787aa8af75b7ba8c.zip |
Move almost all functions' parameter db.Engine to context.Context (#19748)
* Move almost all functions' parameter db.Engine to context.Context
* remove some unnecessary wrap functions
Diffstat (limited to 'models/repo/repo_list.go')
-rw-r--r-- | models/repo/repo_list.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/models/repo/repo_list.go b/models/repo/repo_list.go index 571604a2c2..23cdd6cad6 100644 --- a/models/repo/repo_list.go +++ b/models/repo/repo_list.go @@ -22,9 +22,10 @@ func GetUserMirrorRepositories(userID int64) ([]*Repository, error) { func IterateRepository(f func(repo *Repository) error) error { var start int batchSize := setting.Database.IterateBufferSize + sess := db.GetEngine(db.DefaultContext) for { repos := make([]*Repository, 0, batchSize) - if err := db.GetEngine(db.DefaultContext).Limit(batchSize, start).Find(&repos); err != nil { + if err := sess.Limit(batchSize, start).Find(&repos); err != nil { return err } if len(repos) == 0 { |