Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always call readyForPromotedProduct on the main actor #4584

Merged
merged 2 commits into from
Dec 16, 2024

Conversation

fire-at-will
Copy link
Contributor

@fire-at-will fire-at-will commented Dec 12, 2024

Motivation

This PR is a potential fix for #4582. A customer is reporting occasional crashes when the PurchaseDelegate's readyForPromotedProduct. The stacktraces indicate that this is happening in both SK1 & SK2 flows. My current theory is that we are calling the readyForPromotedProduct function on a background thread when the calling code expects it to be on the main actor/thread.

Update: We heard back from the creator of the issue, and the code that their calling code is in a @mainactor class.

Description

This PR:

  • Always calls the PurchaseDelegate's readyForPromotedProduct on the main actor
  • Updates PurchaseDeferredPurchasesTests and PurchaseDeferredPurchasesSK2Tests to wait for the callback to be completed since it's now called asynchronusly

@fire-at-will fire-at-will added the pr:fix A bug fix label Dec 12, 2024
@fire-at-will fire-at-will requested a review from a team December 13, 2024 18:39
@fire-at-will fire-at-will marked this pull request as ready for review December 13, 2024 18:42
@fire-at-will fire-at-will changed the title Do Not Merge: Always call readyForPromotedProduct on the main actor Always call readyForPromotedProduct on the main actor Dec 13, 2024
@fire-at-will fire-at-will merged commit e78c56d into main Dec 16, 2024
10 checks passed
@fire-at-will fire-at-will deleted the potential-fix-for-gh-4582 branch December 16, 2024 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr:fix A bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants