Skip to content
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

Pass empty timetable to TransitLayerUpdater in order to clear added trip patterns #6280

Open
wants to merge 3 commits into
base: dev-2.x
Choose a base branch
from

Conversation

miklcct
Copy link
Contributor

@miklcct miklcct commented Nov 26, 2024

PR Instructions

Summary

Currently, after clearing TimetableSnapshot, if it is committed directly empty, nothing is passed to TransitLayerUpdater. As a result, previously added trip patterns remain in the TransitLayer for routing purpose, resulting in stale timetables returned in itinerary results which no longer exist in the actual, published timetable snapshot.

Issue

Fixes #6197

Unit tests

Added

Documentation

Bug fix only, not needed

Changelog

@miklcct miklcct marked this pull request as ready for review November 27, 2024 11:54
@miklcct miklcct requested a review from a team as a code owner November 27, 2024 11:54
Copy link

codecov bot commented Nov 27, 2024

Codecov Report

Attention: Patch coverage is 84.09091% with 7 lines in your changes missing coverage. Please review.

Project coverage is 69.78%. Comparing base (3a4753e) to head (82a9c29).
Report is 50 commits behind head on dev-2.x.

Files with missing lines Patch % Lines
...main/java/org/opentripplanner/model/Timetable.java 45.45% 2 Missing and 4 partials ⚠️
...a/org/opentripplanner/model/TimetableSnapshot.java 96.96% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             dev-2.x    #6280      +/-   ##
=============================================
+ Coverage      69.76%   69.78%   +0.02%     
- Complexity     17751    17792      +41     
=============================================
  Files           2010     2017       +7     
  Lines          75948    76079     +131     
  Branches        7784     7789       +5     
=============================================
+ Hits           52984    53095     +111     
- Misses         20257    20274      +17     
- Partials        2707     2710       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@leonardehrenfried leonardehrenfried changed the title Pass empty timetable to TransitLayerUpdater for cleared added trip patterns Pass empty timetable to TransitLayerUpdater in order to clear added trip patterns Nov 29, 2024
@@ -552,7 +552,39 @@ public boolean isEmpty() {
* @return true if the timetable changed as a result of the call
*/
private boolean clearTimetables(String feedId) {
return timetables.keySet().removeIf(tripPattern -> feedId.equals(tripPattern.getFeedId()));
var dirty = false;
dirtyTimetables.clear();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I not sure if it's less confusing to just tell the TransitLayerUpdater to drop all previously added timetables. I think @vpaturet will be the best person to say.

@t2gran t2gran requested a review from vpaturet November 29, 2024 10:36
@miklcct
Copy link
Contributor Author

miklcct commented Nov 30, 2024

Sorry it seems that the bug still appears on the live server, so I need to mark this as draft for now.

@miklcct miklcct marked this pull request as draft November 30, 2024 08:47
@miklcct
Copy link
Contributor Author

miklcct commented Nov 30, 2024

The solution will not work if a timetable is cleared multiple times between commits. Also on my live server log there are a lot of "WARN could not fetch timetable for pattern" which may be related to this problem as well. I'll need to further fix it.

@miklcct
Copy link
Contributor Author

miklcct commented Nov 30, 2024

What does this line actually mean:

My server log is flooded with this.

@miklcct miklcct marked this pull request as ready for review December 2, 2024 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Stale services are used for journey planning
2 participants