GTFS-RT Trip Update schedule status > fix wrong 1 min validity#180
Merged
Conversation
Also clarify useful VS validity. Also fixes UI showing static data every min before reloading RT data (because 1 min old RT data was not "useful")
Contributor
There was a problem hiding this comment.
Pull request overview
This PR clarifies and corrects “useful vs validity” semantics for status objects, particularly for GTFS-RT Trip Updates, so that real-time data isn’t treated as “not useful” after only 1 minute (which was causing the UI to fall back to static data before RT refresh completes).
Changes:
- Rename/standardize status expiry from
validityInMstomaxValidityInMsacrossPOIStatus-based models and provider contract columns. - Update GTFS-RT Trip Updates schedule creation to use the provider’s max validity rather than the 1-minute refresh validity.
- Add
isValid()helpers (and refactorisUseful()to delegate) for clearer status staleness checks.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/test/java/org/mtransit/android/commons/provider/status/GTFSRealTimeTripUpdatesProviderTests.kt | Updates test schedule construction to use maxValidityInMs. |
| src/main/java/org/mtransit/android/MtLogExt.kt | Adjusts date-time log formatting (time style). |
| src/main/java/org/mtransit/android/commons/provider/status/StatusProviderContract.kt | Renames projection/column constant to T_STATUS_K_MAX_VALIDITY and keeps max validity defaults. |
| src/main/java/org/mtransit/android/commons/provider/status/StatusProvider.java | Maps DB validity column to the renamed contract column alias. |
| src/main/java/org/mtransit/android/commons/provider/status/GTFSRealTimeTripUpdatesProvider.kt | Uses statusMaxValidityInMs when building/caching schedules for trip updates. |
| src/main/java/org/mtransit/android/commons/data/ServiceUpdate.java | Refactors usefulness to isValid() for clarity. |
| src/main/java/org/mtransit/android/commons/data/ScheduleExt.kt | Renames schedule factory parameter and introduces makeSchedule2 with deprecation wrapper. |
| src/main/java/org/mtransit/android/commons/data/Schedule.java | Switches schedule usefulness to isValid() and adds an overridden validity rule. |
| src/main/java/org/mtransit/android/commons/data/POIStatus.java | Renames stored validity field to maxValidityInMs, updates cursor/ContentValues mapping, and adds isValid(). |
| src/main/java/org/mtransit/android/commons/data/News.java | Refactors usefulness to isValid() and modernizes hashCode() implementation for longs. |
| src/main/java/org/mtransit/android/commons/data/AvailabilityPercent.java | Uses getMaxValidityInMs() when copying from a POIStatus. |
| src/main/java/org/mtransit/android/commons/data/AppStatus.java | Uses getMaxValidityInMs() when copying from a POIStatus. |
mmathieum
added a commit
to mtransitapps/mtransit-for-android
that referenced
this pull request
Jul 22, 2026
mmathieum
added a commit
to mtransitapps/mtransit-for-android
that referenced
this pull request
Jul 22, 2026
… > fix wrong 1 min `validity` mtransitapps/commons-android#180
montransit
added a commit
to mtransitapps/ca-moose-jaw-transit-bus-android
that referenced
this pull request
Jul 23, 2026
- commons: Build(deps): Bump com.google.android.libraries.ads.mobile.sdk:ads-mobile-sdk from 1.2.1 to 1.3.0 mtransitapps/commons#819 - commons-android: GTFS-RT Trip Update schedule status > fix wrong 1 min `validity` mtransitapps/commons-android#180 - parser: `JSON` > `use_route_long_name_for_route_short_name` > use RSN cleaners
montransit
added a commit
to mtransitapps/ca-mrc-nicolet-yamaska-bili-bus-android
that referenced
this pull request
Jul 23, 2026
- commons: Build(deps): Bump com.google.android.libraries.ads.mobile.sdk:ads-mobile-sdk from 1.2.1 to 1.3.0 mtransitapps/commons#819 - commons-android: GTFS-RT Trip Update schedule status > fix wrong 1 min `validity` mtransitapps/commons-android#180 - parser: `JSON` > `use_route_long_name_for_route_short_name` > use RSN cleaners
montransit
added a commit
to mtransitapps/ca-st-hyacinthe-transport-collectif-bus-android
that referenced
this pull request
Jul 23, 2026
- commons: Build(deps): Bump com.google.android.libraries.ads.mobile.sdk:ads-mobile-sdk from 1.2.1 to 1.3.0 mtransitapps/commons#819 - commons-android: GTFS-RT Trip Update schedule status > fix wrong 1 min `validity` mtransitapps/commons-android#180 - parser: `JSON` > `use_route_long_name_for_route_short_name` > use RSN cleaners
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Also clarify useful VS validity.
Also fixes UI showing static data every min before reloading RT data (because 1 min old RT data was not "useful")
usefulVSvalidity🤯 #179