-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix removal of old vehicle positions #6523
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix removal of old vehicle positions #6523
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev-2.x #6523 +/- ##
=============================================
+ Coverage 70.17% 70.20% +0.03%
- Complexity 18312 18324 +12
=============================================
Files 2082 2085 +3
Lines 77214 77291 +77
Branches 7831 7834 +3
=============================================
+ Hits 54188 54266 +78
+ Misses 20256 20251 -5
- Partials 2770 2774 +4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
@@ -13,15 +14,8 @@ public interface RealtimeVehicleRepository { | |||
* This means that if there are two updaters providing vehicles for the same pattern they | |||
* overwrite each other. | |||
*/ | |||
void setRealtimeVehicles(TripPattern pattern, List<RealtimeVehicle> updates); | |||
void setRealtimeVehicles(String feedId, Multimap<TripPattern, RealtimeVehicle> updates); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update javadoc, this no longer updates vehicles just for one pattern but rather for the whole feed? Perhaps also rename the method so it's clear what this updates.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated the Javadoc but I'm unsure what a better name is. Maybe setRealtimeVehiclesForFeed
?
...ava/org/opentripplanner/service/realtimevehicles/internal/DefaultRealtimeVehicleService.java
Outdated
Show resolved
Hide resolved
...ava/org/opentripplanner/service/realtimevehicles/internal/DefaultRealtimeVehicleService.java
Outdated
Show resolved
Hide resolved
...rc/main/java/org/opentripplanner/updater/vehicle_position/RealtimeVehiclePatternMatcher.java
Show resolved
Hide resolved
13d29cf
to
685d2ed
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fix seems to work well, thank you, and code is clean.
Summary
The real time vehicle service does not correctly remove the data from the previous download which this PR fixes.
It introduces copy-on-write semantics for the service rather than explicit removal by the calling code, reducing the number of places where mutable state is handled.
It also adds a new GraphQL property so that the last update is now expressed as an ISO date time rather than number of seconds since the epoch.
Issue
n/a
Unit tests
Added.
Documentation
Javadoc
cc @whitneys-pm