Skip to content

Commit

Permalink
Additional fvsl cache fixes (#293)
Browse files Browse the repository at this point in the history
  • Loading branch information
irees authored Dec 12, 2024
1 parent b554b2a commit f5f7dbd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions finders/dbfinder/finder.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ func (f *Finder) RouteStopBuffer(ctx context.Context, param *model.RouteStopBuff

func (f *Finder) FindFeedVersionServiceWindow(ctx context.Context, fvid int) (*model.ServiceWindow, error) {
a, _, err := f.fvslCache.Get(ctx, fvid)
if err != nil {
return nil, err
}
// Get local time
nowLocal := time.Now().In(a.Location)
if model.ForContext(ctx).Clock != nil {
Expand Down
2 changes: 1 addition & 1 deletion finders/rtfinder/finder.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ func (f *Finder) FindStopTimeUpdate(t *model.Trip, st *model.StopTime) (*model.R
// Matched on trip, but no match on stop sequence or stop_id
return &model.RTStopTimeUpdate{TripUpdate: rtTrip, LastDelay: copyPtr(lastDelay)}, true
}
log.Trace().Str("trip_id", t.TripID.Val).Int("seq", seq).Msgf("no stop time update found")
// log.Trace().Str("trip_id", t.TripID.Val).Int("seq", seq).Msgf("no stop time update found")
return nil, false
}

Expand Down
4 changes: 4 additions & 0 deletions internal/clock/swcache.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package clock

import (
"context"
"fmt"
"sync"
"time"

Expand Down Expand Up @@ -47,6 +48,9 @@ func (f *ServiceWindowCache) Get(ctx context.Context, fvid int) (ServiceWindow,
if err != nil {
return a, false, err
}
if fvData.Location == nil {
return a, false, fmt.Errorf("unable to get cached default timezone for feed version %d", fvid)
}
a.Location = fvData.Location

// Get fallback week from FVSL data
Expand Down

0 comments on commit f5f7dbd

Please sign in to comment.