mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Add repo-sync-releases admin command (#3254)
* Add repo-sync-releases admin command Will help recovering corrupted database, see #3247 * Load repos in chunks of 10, exit with error if unable to get a list, scan private repos, fix typo * Fix debug output about num releases * Introduce RepositoryListDefaultPageSize constant, set to 64 Use it from the new admin command * Use RepositoryListDefaultPageSize in more places * Document RepositoryListDefaultPageSize
This commit is contained in:
committed by
Lauris BH
parent
ae9cc8f972
commit
8cd987af0c
@@ -29,7 +29,7 @@ func populateIssueIndexer() error {
|
||||
for page := 1; ; page++ {
|
||||
repos, _, err := SearchRepositoryByName(&SearchRepoOptions{
|
||||
Page: page,
|
||||
PageSize: 10,
|
||||
PageSize: RepositoryListDefaultPageSize,
|
||||
OrderBy: SearchOrderByID,
|
||||
Private: true,
|
||||
Collaborate: util.OptionalBoolFalse,
|
||||
|
@@ -31,7 +31,7 @@ func releaseAddColumnIsTagAndSyncTags(x *xorm.Engine) error {
|
||||
|
||||
// For the sake of SQLite3, we can't use x.Iterate here.
|
||||
offset := 0
|
||||
pageSize := 20
|
||||
pageSize := models.RepositoryListDefaultPageSize
|
||||
for {
|
||||
repos := make([]*models.Repository, 0, pageSize)
|
||||
if err := x.Table("repository").Asc("id").Limit(pageSize, offset).Find(&repos); err != nil {
|
||||
|
@@ -81,7 +81,7 @@ func populateRepoIndexer() error {
|
||||
for page := 1; ; page++ {
|
||||
repos, _, err := SearchRepositoryByName(&SearchRepoOptions{
|
||||
Page: page,
|
||||
PageSize: 10,
|
||||
PageSize: RepositoryListDefaultPageSize,
|
||||
OrderBy: SearchOrderByID,
|
||||
Private: true,
|
||||
})
|
||||
|
@@ -13,6 +13,13 @@ import (
|
||||
"github.com/go-xorm/builder"
|
||||
)
|
||||
|
||||
// RepositoryListDefaultPageSize is the default number of repositories
|
||||
// to load in memory when running administrative tasks on all (or almost
|
||||
// all) of them.
|
||||
// The number should be low enough to avoid filling up all RAM with
|
||||
// repository data...
|
||||
const RepositoryListDefaultPageSize = 64
|
||||
|
||||
// RepositoryList contains a list of repositories
|
||||
type RepositoryList []*Repository
|
||||
|
||||
|
Reference in New Issue
Block a user