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

Fix OfferingsParser exceptions being swallowed #1228

Merged
merged 3 commits into from
Sep 7, 2023

Conversation

vegaro
Copy link
Contributor

@vegaro vegaro commented Sep 7, 2023

This should be fixed in other places too, but for now, I am just fixing it in OfferingsParser

offeringParser = offeringParser
billing,
offeringParser,
dispatcher
)
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am not entirely sure what else to test here. The issue was due to billing.queryProductDetailsAsync( returning in a different thread, but we can't really test that 🤔

@vegaro vegaro requested a review from a team September 7, 2023 13:56
@vegaro vegaro marked this pull request as ready for review September 7, 2023 13:56
@codecov
Copy link

codecov bot commented Sep 7, 2023

Codecov Report

❗ No coverage uploaded for pull request base (paywalls@2d89728). Click here to learn what that means.
Patch has no changes to coverable lines.

Additional details and impacted files
@@             Coverage Diff             @@
##             paywalls    #1228   +/-   ##
===========================================
  Coverage            ?   85.12%           
===========================================
  Files               ?      187           
  Lines               ?     6345           
  Branches            ?      923           
===========================================
  Hits                ?     5401           
  Misses              ?      597           
  Partials            ?      347           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

.groupBy { subProduct -> subProduct.purchasingData.productId }
.toMutableMap()
val subscriptionIds = productsById.keys
dispatcher.enqueue(command = {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm wondering if we should do this inside the BillingWrapper.queryProductDetailsAsync so it fixes possible problems in other places that call it... But I'm ok doing this for now and rethinking it later.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's true... But that might involve more testing since it might break other parts of the code. I think I am ok with doing this for now, then fixing all calls in BillingWrapper to return in our own threads

@vegaro vegaro merged commit b98cdf6 into paywalls Sep 7, 2023
7 checks passed
@vegaro vegaro deleted the fix-offerings-exceptions branch September 7, 2023 14:27
@NachoSoto
Copy link
Contributor

Nice!

A couple questions:

  • Would it be possible to write tests for this?
  • Would this be useful in main too?

@tonidero
Copy link
Contributor

tonidero commented Sep 8, 2023

Would it be possible to write tests for this?

Probably yes, but it would be tricky, since this happens when a crash happens in Google's Billing client thread. I think we should be able to reproduce with a normal background thread though so it should be doable.

Would this be useful in main too?

Yes, though since we only found about this issue due to crashes while parsing the offerings response, and the chance that this may be a risky change, we decided to keep it isolated to this area for now. I added a ticket to track it and do it for the whole app though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants