-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Clean up of GTFS-RT adapter #7238
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
Clean up of GTFS-RT adapter #7238
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## dev-2.x #7238 +/- ##
=============================================
+ Coverage 72.13% 72.16% +0.02%
+ Complexity 21087 21085 -2
=============================================
Files 2297 2298 +1
Lines 85233 85184 -49
Branches 8489 8482 -7
=============================================
- Hits 61484 61474 -10
+ Misses 20770 20736 -34
+ Partials 2979 2974 -5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
9343c38 to
0bb8ffa
Compare
9fe021d to
0a89aaf
Compare
optionsome
left a comment
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 changes are a bit hard to read, but I think I'll test locally a bit when this is otherwise ready.
| if (failuresByRelationship.containsKey(scheduleRelationship)) { | ||
| var c = failuresByRelationship.get(scheduleRelationship); | ||
| failuresByRelationship.put(scheduleRelationship, ++c); | ||
| } else { | ||
| failuresByRelationship.put(scheduleRelationship, 1); |
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.
This logic could be "simplified" to be failuresByRelationship.merge(scheduleRelationship, 1, (a, b) -> a + b), but I don't know if it's more readable or not :D.
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.
Maybe failuresByRelationship.merge(scheduleRelationship, 1, Integer::sum) is even simpler.
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 was the one that originally added this logging but I actually don't think it's useful anymore. I can remove it altogether if you allow me.
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 would be fine with removing it. We still have the logging based on error types, right?
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.
And thanks for this tip - I didn't know about merge.
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.
Ok, will remove. Yes, we have logging based on the error type.
application/src/main/java/org/opentripplanner/updater/trip/gtfs/RouteBuilder.java
Outdated
Show resolved
Hide resolved
0a89aaf to
7e3c31c
Compare
# Conflicts: # application/src/main/java/org/opentripplanner/updater/trip/gtfs/TripTimesUpdater.java
# Conflicts: # application/src/main/java/org/opentripplanner/updater/trip/gtfs/GtfsRealTimeTripUpdateAdapter.java
Remove trace and debug log statements
7e3c31c to
4c4c657
Compare
576d577 to
0df0077
Compare
0df0077 to
e7d3697
Compare
|
I also moved the validation of the stop sequence to the |
Summary
The GTFS-RT adapter has accumulated tech debt some of which this PR reduces. In particular it:
TripUpdateis contructed it is validated and calls totripId()andserviceDate()are safe and non-null.timeZoneanddeduplicator, which never change, are passed to the contructor ofTripTimesUpdaterUnit tests
One added.
Documentation
Javadoc.
Changelog
Skip.
Bumping the serialization version id
No.