Skip to content

Commit

Permalink
Merge pull request #1016 from JustaPenguin/scheduled-championship-rac…
Browse files Browse the repository at this point in the history
…e-weekends

don't load championship race weekends twice when scheduling, use the faster extraction from championships
  • Loading branch information
cj123 authored Sep 16, 2020
2 parents 65b2dab + 7733665 commit c4ac989
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Fixed:
* The Live Timings timer will now show the number of days remaining in an event if it is longer than a day.
* Fixes an issue where duplicating a Race Weekend in a Championship could cause Server Manager to crash.
* Fixes an issue where decimal values could not be modified in Real Penalty Options.
* Fixes an issue where scheduled Championship Race Weekends could cause excessive CPU load when rendering the calendar.
* Race Weekend sessions with multiple parents now filter out any duplicate entrants, keeping the entrant with the lowest sort position.

---
Expand Down
9 changes: 2 additions & 7 deletions scheduled_races.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ func (srm *ScheduledRacesManager) getScheduledRaces(forAllServers bool) ([]Sched
}

for _, championship := range championships {
for _, event := range championship.Events {
for _, event := range ExtractRaceWeekendSessionsIntoIndividualEvents(championship.Events) {
if event.Scheduled.IsZero() || (!forAllServers && event.ScheduledServerID != serverID) {
continue
}
Expand All @@ -211,12 +211,7 @@ func (srm *ScheduledRacesManager) getScheduledRaces(forAllServers bool) ([]Sched

for _, raceWeekend := range raceWeekends {
if raceWeekend.HasLinkedChampionship() {
raceWeekend.Championship, err = srm.store.LoadChampionship(raceWeekend.ChampionshipID.String())

if err != nil {
logrus.WithError(err).Warnf("Could not load linked Championship for Race Weekend")
continue
}
continue // they'll be picked up from championship events
}

for _, session := range raceWeekend.Sessions {
Expand Down

0 comments on commit c4ac989

Please sign in to comment.