1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

Refactor more filterslice (#30370)

This commit is contained in:
Lunny Xiao
2024-04-10 12:18:41 +08:00
committed by GitHub
parent 310e2517e5
commit b09687f1d1
3 changed files with 13 additions and 23 deletions

View File

@@ -36,16 +36,9 @@ func (runners RunnerList) LoadOwners(ctx context.Context) error {
}
func (runners RunnerList) getRepoIDs() []int64 {
repoIDs := make(container.Set[int64], len(runners))
for _, runner := range runners {
if runner.RepoID == 0 {
continue
}
if _, ok := repoIDs[runner.RepoID]; !ok {
repoIDs[runner.RepoID] = struct{}{}
}
}
return repoIDs.Values()
return container.FilterSlice(runners, func(runner *ActionRunner) (int64, bool) {
return runner.RepoID, runner.RepoID > 0
})
}
func (runners RunnerList) LoadRepos(ctx context.Context) error {