Issue 5284 prevent retries for genuinely failed uploads #5613
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.
Description (required)
Fixes #5284
The overall change of this PR is to add a check in ContributionFragment.retryUpload for whether the failure reason of the previous upload is a "genuine" failure, ie a failure that can't be solved by just retrying. And if it is a "genuine" failure we abandon the retry attempt.
This is accomplished by in uploadWorker passing along the failure point and any accompanying exceptions through two new fields in Contributions. And then checking if these qualify as a "genuine" failure through a simple whitelist of known "genuine" failure patterns and exceptions.
This PR is a draft because we wont be able to continue further due to our course ending. And while the code works, the whitelist content is currently very minimal due to us having issues with reproducing the error, meaning we haven't been able to identify many "genuine" failure patterns or exceptions. However the code should still work to roll out as it is a white list, meaning that for any problem not matching our "genuine" errors it will just fall back on retrying 10 times
Tests performed (required)
Testing was performed, the entire test suite was run and all the of tests that succeeded before the rewrite succeed now also
Tested {build variant, e.g. ProdDebug} on {name of device or emulator} with API level {API level}.
This was tested on on :app:testBetaDebugUnitTest, the API level was 34
Screenshots (for UI changes only)
Need help? See https://support.google.com/android/answer/9075928
Note: Please ensure that you have read CONTRIBUTING.md if this is your first pull request.