Check for valid DirectionsRoute in RouteRefresh#1909
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1909 +/- ##
============================================
+ Coverage 35.04% 35.33% +0.28%
- Complexity 1060 1069 +9
============================================
Files 261 261
Lines 8848 8855 +7
Branches 667 668 +1
============================================
+ Hits 3101 3129 +28
+ Misses 5475 5452 -23
- Partials 272 274 +2 |
Guardiola31337
left a comment
There was a problem hiding this comment.
We should protect against this error. It seems it was produced while sitting in a stale navigation state for a while.
Yeah, I believe that's coming from the periodic refresh call in RouteRefresher
Overall this looks good to me @danesfeder I've left some comments / questions to discuss before merging here. Great test coverage ❤️
| private boolean isInvalid(DirectionsRoute directionsRoute, RefreshCallback refreshCallback) { | ||
| String requestUuid = directionsRoute.routeOptions().requestUuid(); | ||
| if (TextUtils.isEmpty(requestUuid) || directionsRoute.routeIndex() == null) { | ||
| refreshCallback.onError(new RefreshError("RouteProgress passed has invalid DirectionsRoute")); |
There was a problem hiding this comment.
NIT Could we extract this magic number into a constant?
There was a problem hiding this comment.
Not sure if we should report this as an "error" until we know why the Refresh API is returning null after some time stale. Should we maybe stop the periodic refresh for this scenario? 🤔
There was a problem hiding this comment.
I think it's fine to send the error, our behavior is to fail silently:
@Override
public void onError(RefreshError error) {
Timber.w(error.getMessage());
routeRefresher.updateIsChecking(false);
}
I extracted the magic number 👍
5f8828e to
02a2e0e
Compare
Yeah, good to protect against it for now. But we should keep an eye on this. |
Guardiola31337
left a comment
There was a problem hiding this comment.
Thanks for addressing the feedback @danesfeder
![]()
Found while testing:
Description
We should protect against this error. It seems it was produced while sitting in a stale navigation state for a while.
bug,feature,new API(s),SEMVER, etc.)Implementation
Validity check that will fire error callback with error message when invalid.
Testing
Please describe the manual tests that you ran to verify your changes
SNAPSHOTupstream dependencies if needed)Checklist