perf(bg/monetization): reuse PaymentSession when link added#1046
Merged
Conversation
Contributor
Extension builds preview
|
(backward compatible with existing adjustAmount)
sidvishnoi
commented
May 1, 2025
DarianM
approved these changes
May 2, 2025
3 tasks
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.
Context
Part of #976
The goal is to efficiently find the
minSendAmountfor aPaymentSession.Changes proposed in this pull request
Reuse PaymentSession instead of starting a new one.
Original PR summary
AbortSignalthat makes the probing restart.adjustAmount(rate)withfindMinSendAmount()(which is independent of rate). Extracted into 1048.minSendAmount, even if theadjustAmountmay change due to splits.adjustAmountresulting rate is >=minSendAmount, so it makes sense to findminSendAmountfirst, and not find it ever again.minSendAmountin future, but then we'd need to probe/findMinSendAmountagain (existing bug, will fix some time later).Also updated the constructor type forMoved to #1047. I was thinking of adding a staticPaymentSessiona bit.PaymentSession.from(), but we don't need it right now. The new constructor format will help there as well.Before (see quotes requests increasing as link tags added to page, including for existing tags):
Screen.Recording.2025-05-01.at.19.13.12.mov
After (see quotes requests for link tags already added are skipped; fewer requests):
Screen.Recording.2025-05-01.at.19.09.40.mov