Closed bidetofevil closed 2 months ago
✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.
Package | Version | Score | Details |
---|
This stack of pull requests is managed by Graphite. Learn more about stacking.
Join @bidetofevil and the rest of your teammates on Graphite
Attention: Patch coverage is 75.75758%
with 8 lines
in your changes missing coverage. Please review.
Project coverage is 83.24%. Comparing base (
56a46f6
) to head (9cd112e
). Report is 1 commits behind head on master.
Files with missing lines | Patch % | Lines |
---|---|---|
...nal/comms/delivery/EmbracePendingApiCallsSender.kt | 75.75% | 6 Missing and 2 partials :warning: |
Goal
The method used to send failed requests is being invoked before the ApiService is initialized, before
setSendMethod()
is ever called. This leads to a crash in a background thread because alateinit var
was being accessed before it was initialized. This leads tofailed_api_calls..json
to re overridden, which leads to lost data.To fix this, ditch the lateinit var and use an atomic reference to hold the queue. Before trying to access it, check its nullness, and skip if it's null. This will force the api request to retry at the next interval.
A better fix for this will be to delay the retry attempt until after ApiClient is done, but this change is a more appropriate, surgical fix, so we can use this until we make the bigger fix later.
Testing
Added unit test to verify the state of the pending API calls queue depending on whether the SendMethod is set.