mirror of
1
Fork 0

Merge pull request '[BUG] Add early-return to loading items from `SpecList`' (#4582) from gusted/forgejo-early-return into forgejo

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4582
Reviewed-by: Beowulf <beowulf@noreply.codeberg.org>
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
This commit is contained in:
Earl Warren 2024-07-20 07:40:24 +00:00
commit 622479ef7f
1 changed files with 8 additions and 0 deletions

View File

@ -22,6 +22,10 @@ func (specs SpecList) GetScheduleIDs() []int64 {
}
func (specs SpecList) LoadSchedules(ctx context.Context) error {
if len(specs) == 0 {
return nil
}
scheduleIDs := specs.GetScheduleIDs()
schedules, err := GetSchedulesMapByIDs(ctx, scheduleIDs)
if err != nil {
@ -50,6 +54,10 @@ func (specs SpecList) GetRepoIDs() []int64 {
}
func (specs SpecList) LoadRepos(ctx context.Context) error {
if len(specs) == 0 {
return nil
}
repoIDs := specs.GetRepoIDs()
repos, err := repo_model.GetRepositoriesMapByIDs(ctx, repoIDs)
if err != nil {