PurchasesOrchestrator: changed ReceiptRefreshPolicy.always to .onlyIfEmpty after a purchase#2245
Merged
Merged
Conversation
…nlyIfEmpty` after a purchase We've had reports of receipt fetching throttling errors (#2116). #2146 improved this by throttling receipt refreshing. However, we can avoid this altogether by not refreshing the receipt unless it's empty. The main reason being that the backend will automatically refresh the receipt using `/verifyReceipt`, so it doesn't matter if the receipt we post is slightly out of date.
Codecov Report
@@ Coverage Diff @@
## main #2245 +/- ##
=======================================
Coverage 85.85% 85.85%
=======================================
Files 183 183
Lines 12105 12105
=======================================
Hits 10393 10393
Misses 1712 1712
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
aboedo
approved these changes
Jan 25, 2023
tonidero
pushed a commit
that referenced
this pull request
Feb 1, 2023
**This is an automatic release.** ### Bugfixes * `CustomerInfoManager`: improved thread-safety (#2224) via NachoSoto (@NachoSoto) ### Other Changes * `StoreKitIntegrationTests`: replaced `XCTSkipIf` with `XCTExpectFailure` (#2244) via NachoSoto (@NachoSoto) * `PurchasesOrchestrator`: changed `ReceiptRefreshPolicy.always` to `.onlyIfEmpty` after a purchase (#2245) via NachoSoto (@NachoSoto)
NachoSoto
added a commit
that referenced
this pull request
Feb 15, 2023
Fixes #2260 and [SDKONCALL-216]. Follow up to #2245. The change in #2245 was meant to avoid receipt refresh throttling errors (#2116). However, that was a regression when using StoreKit config files because those don't get refreshed in the backend. Unfortunately the workaround introduced in #1945 prevented us from noticing this, because we use `DangerousSettings.InternalSettings.enableReceiptFetchRetry` in our own integration tests. I added an integration test that explicitly covers this scenario. That fails without this change if disabling that dangerous setting. I thought about making that test run without the setting, but that might lead to flaky failures in CI, which is why we introduced that workaround in the first place. But at least now we have an explicit integration test for this, as well as 2 unit tests.
NachoSoto
added a commit
that referenced
this pull request
Feb 15, 2023
…2280) Fixes #2260 and [SDKONCALL-216]. Follow up to #2245. The change in #2245 was meant to avoid receipt refresh throttling errors (#2116). However, that was a regression when using StoreKit config files because those don't get refreshed in the backend. Unfortunately the workaround introduced in #1945 prevented us from noticing this, because we use `DangerousSettings.InternalSettings.enableReceiptFetchRetry` in our own integration tests. I added an integration test that explicitly covers this scenario. That fails without this change if disabling that dangerous setting. I thought about making that test run without the setting, but that might lead to flaky failures in CI, which is why we introduced that workaround in the first place. But at least now we have an explicit integration test for this, as well as 2 unit tests. [SDKONCALL-216]: https://revenuecats.atlassian.net/browse/SDKONCALL-216?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
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.
We've had reports of receipt fetching throttling errors (#2116). #2146 improved this by throttling receipt refreshing.
However, we can avoid this altogether by not refreshing the receipt unless it's empty.
The main reason being that the backend will automatically refresh the receipt using
/verifyReceipt, so it doesn't matter if the receipt we post is slightly out of date.