Created ClockType and TestClock to be able to mock time#2145
Merged
Conversation
This will be used in an upcoming PR, and can also be used to better test `TimingUtil.measureAndLogIfTooSlow` uses.
vegaro
approved these changes
Dec 15, 2022
NachoSoto
added a commit
that referenced
this pull request
Dec 15, 2022
…ottle errors (#2146) Fixes #2116. Depends on #2134, #2144, #2145. We've known that, especially for sandbox accounts with lots of purchases, the SDK can get flooded with a lot of transactions to process at once. I've been making some improvements for this (like #2115). Another consequence of this behavior, is that we can end up failing due to `StoreKit` throttling us (see #2116): > 2022-12-03 12:31:58.670892+0100 app[673:61074] <SKReceiptRefreshRequest: 0x283edc860>: Finished refreshing receipt with error: Error Domain=ASDErrorDomain Code=603 "Request throttled" UserInfo={NSLocalizedFailureReason=Unified receipt is valid and current, NSLocalizedDescription=Request throttled, AMSServerErrorCode=0} This change avoids that by skipping the refresh if less than 2 seconds have elapsed. I chose 2 to make this a low-ish risk change, with a huge benefit for multiple semi-concurrent requests coming from a big transaction queue.
NachoSoto
pushed a commit
that referenced
this pull request
Dec 15, 2022
**This is an automatic release.** ### Bugfixes * Fix sending presentedOfferingIdentifier in StoreKit2 (#2156) via Toni Rico (@tonidero) * `ReceiptFetcher`: throttle receipt refreshing to avoid `StoreKit` throttle errors (#2146) via NachoSoto (@NachoSoto) ### Other Changes * Added integration and unit tests to verify observer mode behavior (#2069) via NachoSoto (@NachoSoto) * Created `ClockType` and `TestClock` to be able to mock time (#2145) via NachoSoto (@NachoSoto) * Extracted `asyncWait` to poll `async` conditions in tests (#2134) via NachoSoto (@NachoSoto) * `StoreKitRequestFetcher`: added log when starting/ending requests (#2151) via NachoSoto (@NachoSoto) * `CI`: fixed `PurchaseTester` deployment (#2147) via NachoSoto (@NachoSoto)
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.
This will be used in an upcoming PR, and can also be used to better test
TimingUtil.measureAndLogIfTooSlowuses.