Skip to content

Commit 79c554d

Browse files
committed
fix: duplicated repo IDs
1 parent e7cfe51 commit 79c554d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

modules/indexer/issues/indexer.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313

1414
db_model "code.gitea.io/gitea/models/db"
1515
repo_model "code.gitea.io/gitea/models/repo"
16+
"code.gitea.io/gitea/modules/container"
1617
"code.gitea.io/gitea/modules/graceful"
1718
"code.gitea.io/gitea/modules/indexer/issues/bleve"
1819
"code.gitea.io/gitea/modules/indexer/issues/db"
@@ -338,9 +339,10 @@ func CountIssuesByRepo(ctx context.Context, opts *SearchOptions) (map[int64]int6
338339
return nil, fmt.Errorf("opts.AllPublic must be false")
339340
}
340341

341-
ret := make(map[int64]int64, len(opts.RepoIDs))
342+
repoIDs := container.SetOf(opts.RepoIDs...).Values()
343+
ret := make(map[int64]int64, len(repoIDs))
342344
// TODO: it could be faster if do it in parallel for some indexer engines. Improve it if users report it's slow.
343-
for _, repoID := range opts.RepoIDs {
345+
for _, repoID := range repoIDs {
344346
count, err := CountIssues(ctx, opts.Copy(func(o *internal.SearchOptions) { o.RepoIDs = []int64{repoID} }))
345347
if err != nil {
346348
return nil, err

0 commit comments

Comments
 (0)