Skip to content

Commit c3f5f9c

Browse files
committed
fix: use Copy
1 parent 36b1cfe commit c3f5f9c

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

modules/indexer/issues/indexer.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -338,16 +338,10 @@ func CountIssuesByRepo(ctx context.Context, opts *SearchOptions) (map[int64]int6
338338
return nil, fmt.Errorf("opts.AllPublic must be false")
339339
}
340340

341-
resoIDs := opts.RepoIDs
342-
defer func() {
343-
opts.RepoIDs = resoIDs
344-
}()
345-
346341
ret := make(map[int64]int64, len(opts.RepoIDs))
347342
// TODO: it could be faster if do it in parallel for some indexer engines. Improve it if users report it's slow.
348-
for _, repoID := range resoIDs {
349-
opts.RepoIDs = []int64{repoID}
350-
count, err := CountIssues(ctx, opts)
343+
for _, repoID := range opts.RepoIDs {
344+
count, err := CountIssues(ctx, opts.Copy(func(o *internal.SearchOptions) { o.RepoIDs = []int64{repoID} }))
351345
if err != nil {
352346
return nil, err
353347
}

0 commit comments

Comments
 (0)