diff options
author | Lauris BH <lauris@nix.lv> | 2020-02-14 14:42:30 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-14 13:42:30 +0100 |
commit | a1d796f521919e653f5ceb64d7d361a64cc0139f (patch) | |
tree | ee77601af4b21809317b930f5c7232ac52f2a638 /models/repo_indexer.go | |
parent | ff261dafc4845941756a2421acec265663b94e5e (diff) | |
download | gitea-a1d796f521919e653f5ceb64d7d361a64cc0139f.tar.gz gitea-a1d796f521919e653f5ceb64d7d361a64cc0139f.zip |
Index code and stats only for non-empty repositories (#10251)
Fix test and switch to unique queue
Fix MySQL support when deleting old statistics
Diffstat (limited to 'models/repo_indexer.go')
-rw-r--r-- | models/repo_indexer.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/models/repo_indexer.go b/models/repo_indexer.go index 1f5ab928ab..de3358f55a 100644 --- a/models/repo_indexer.go +++ b/models/repo_indexer.go @@ -34,6 +34,8 @@ func GetUnindexedRepos(indexerType RepoIndexerType, maxRepoID int64, page, pageS ids := make([]int64, 0, 50) cond := builder.Cond(builder.IsNull{ "repo_indexer_status.id", + }).And(builder.Eq{ + "repository.is_empty": false, }) sess := x.Table("repository").Join("LEFT OUTER", "repo_indexer_status", "repository.id = repo_indexer_status.repo_id AND repo_indexer_status.indexer_type = ?", indexerType) if maxRepoID > 0 { @@ -66,11 +68,11 @@ func (repo *Repository) getIndexerStatus(e Engine, indexerType RepoIndexerType) return repo.StatsIndexerStatus, nil } } - status := &RepoIndexerStatus{RepoID: repo.ID, IndexerType: indexerType} - has, err := e.Get(status) - if err != nil { + status := &RepoIndexerStatus{RepoID: repo.ID} + if has, err := e.Where("`indexer_type` = ?", indexerType).Get(status); err != nil { return nil, err } else if !has { + status.IndexerType = indexerType status.CommitSha = "" } switch indexerType { |