Skip to content

Created ClockType and TestClock to be able to mock time#2145

Merged
NachoSoto merged 1 commit into
mainfrom
clock-type
Dec 15, 2022
Merged

Created ClockType and TestClock to be able to mock time#2145
NachoSoto merged 1 commit into
mainfrom
clock-type

Conversation

@NachoSoto

Copy link
Copy Markdown
Contributor

This will be used in an upcoming PR, and can also be used to better test TimingUtil.measureAndLogIfTooSlow uses.

This will be used in an upcoming PR, and can also be used to better test `TimingUtil.measureAndLogIfTooSlow` uses.
@NachoSoto NachoSoto merged commit b10e87a into main Dec 15, 2022
@NachoSoto NachoSoto deleted the clock-type branch December 15, 2022 17:01
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants