Skip to content

CachingProductsManager: use partial cached products#2014

Merged
NachoSoto merged 2 commits into
mainfrom
products-manager-reuse-cached-products
Nov 8, 2022
Merged

CachingProductsManager: use partial cached products#2014
NachoSoto merged 2 commits into
mainfrom
products-manager-reuse-cached-products

Conversation

@NachoSoto

Copy link
Copy Markdown
Contributor

#1907 introduced this CachingProductsManager abstraction, but simply copied the existing caching mechanism, which was very limited. This expands on it by not ignoring cached products when not all requested products are found. Instead, it uses the partial cache hit, and requests the rest of products.

This performance optimization is illustrated in the test change, as the second request only fetches the missing product now.

@NachoSoto NachoSoto added the perf label Oct 31, 2022
@NachoSoto NachoSoto requested a review from a team October 31, 2022 17:42
Base automatically changed from set-adding to main October 31, 2022 23:20
@NachoSoto NachoSoto force-pushed the products-manager-reuse-cached-products branch from 4dcc5df to 1e3fd8e Compare November 3, 2022 22:11
Comment thread Sources/Purchasing/CachingProductsManager.swift Outdated

@tonidero tonidero left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this works!

Comment thread Sources/Purchasing/CachingProductsManager.swift Outdated
#1907 introduced this `CachingProductsManager` abstraction, but simply copied the existing caching mechanism, which was very limited.
This expands on it by not ignoring cached products when not _all_ requested products are found. Instead, it uses the partial cache hit, and requests the rest of products.

This performance optimization is illustrated in the test change, as the second request only fetches the missing product now.
@NachoSoto NachoSoto force-pushed the products-manager-reuse-cached-products branch from c3ff43e to f2f3fa2 Compare November 8, 2022 17:19
@NachoSoto NachoSoto merged commit 6c0b026 into main Nov 8, 2022
@NachoSoto NachoSoto deleted the products-manager-reuse-cached-products branch November 8, 2022 17:27
NachoSoto pushed a commit that referenced this pull request Nov 9, 2022
**This is an automatic release.**

### Bugfixes
* `ISO8601DateFormatter.withMilliseconds`: fixed iOS 11 crash (#2037)
via NachoSoto (@NachoSoto)
* Changed `StoreKit2Setting.default` back to
`.enabledOnlyForOptimizations` (#2022) via NachoSoto (@NachoSoto)
### Other Changes
* `Integration Tests`: changed weekly to monthly subscriptions to work
around 0-second subscriptions (#2042) via NachoSoto (@NachoSoto)
* `Integration Tests`: fixed `testPurchaseWithAskToBuyPostsReceipt`
(#2040) via NachoSoto (@NachoSoto)
* `ReceiptRefreshPolicy.retryUntilProductIsFound`: default to returning
"invalid" receipt (#2024) via NachoSoto (@NachoSoto)
* `CachingProductsManager`: use partial cached products (#2014) via
NachoSoto (@NachoSoto)
* Added `BackendErrorCode.purchasedProductMissingInAppleReceipt` (#2033)
via NachoSoto (@NachoSoto)
* `PurchaseTesterSwiftUI`: replaced `Purchases` dependency with `SPM`
(#2027) via NachoSoto (@NachoSoto)
* `Integration Tests`: changed log output to `raw` (#2031) via NachoSoto
(@NachoSoto)
* `Integration Tests`: run on iOS 16 (#2035) via NachoSoto (@NachoSoto)
* CI: fixed `iOS 14` tests Xcode version (#2030) via NachoSoto
(@NachoSoto)
* `Async.call`: added non-throwing overload (#2006) via NachoSoto
(@NachoSoto)
* Documentation: Fixed references in `V4_API_Migration_guide.md` (#2018)
via NachoSoto (@NachoSoto)
* `eligiblePromotionalOffers`: don't log error if response is ineligible
(#2019) via NachoSoto (@NachoSoto)
* Runs push-pods after make-release (#2025) via Cesar de la Vega
(@vegaro)
* Some updates on notify-on-non-patch-release-branches: (#2026) via
Cesar de la Vega (@vegaro)
* Deploy `PurchaseTesterSwiftUI` to TestFlight (#2003) via NachoSoto
(@NachoSoto)
* `PurchaseTesterSwiftUI`: added "logs" screen (#2012) via NachoSoto
(@NachoSoto)
* `PurchaseTesterSwiftUI`: allow configuring API key at runtime (#1999)
via NachoSoto (@NachoSoto)
@vegaro vegaro added pr:other and removed pr:perf labels Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants