Skip to content

Conversation

@staskus
Copy link
Contributor

@staskus staskus commented Feb 19, 2025

Closes: #15181
Merge after: #15207

Description

Cancel payment after leaving POS.

With these changes, memory leaks continue for me when exiting POS while in "Tap/Swipe/Insert" state. I noticed that in this instance CardPresentPaymentCollectOrderPaymentUseCaseAdaptor task cancelation and continuation are not called. I wonder if it could be a reason for the leaks, since if withCheckedThrowingContinuation is not resumed, the Task continues. Just one of the ideas.

Steps to reproduce

  1. Open POS
  2. Connect to the card reader
  3. Check out
  4. Wait for "Tap/Swipe/Insert"
  5. Exit POS
  6. Confirm that the payment is canceled and doesn't follow through. Previously, payment would continue. This doesn't solve a memory leak issue.

Testing information

Tested with iPad Pro 11 inch iOS 18.2 simulator.


  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

Reviewer (or Author, in the case of optional code reviews):

Please make sure these conditions are met before approving the PR, or request changes if the PR needs improvement:

  • The PR is small and has a clear, single focus, or a valid explanation is provided in the description. If needed, please request to split it into smaller PRs.
  • Ensure Adequate Unit Test Coverage: The changes are reasonably covered by unit tests or an explanation is provided in the PR description.
  • Manual Testing: The author listed all the tests they ran, including smoke tests when needed (e.g., for refactorings). The reviewer confirmed that the PR works as expected on all devices (phone/tablet) and no regressions are added.

@staskus staskus added type: bug A confirmed bug. feature: POS labels Feb 19, 2025
@staskus staskus added this to the 21.8 milestone Feb 19, 2025
@staskus staskus changed the title [Woo POS] Cancel payment after leaving POS [Woo POS] Cancel payment after leaving POS & memory leak investigation Feb 19, 2025
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Feb 19, 2025

WooCommerce iOS📲 You can test the changes from this Pull Request in WooCommerce iOS by scanning the QR code below to install the corresponding build.

App NameWooCommerce iOS WooCommerce iOS
Build Numberpr15205-0acbbbc
Version21.7
Bundle IDcom.automattic.alpha.woocommerce
Commit0acbbbc
App Center BuildWooCommerce - Prototype Builds #13077
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

@staskus staskus force-pushed the fix/15180-memory-leaks branch from e9afb3d to 4a24a70 Compare February 19, 2025 15:31
@staskus staskus changed the title [Woo POS] Cancel payment after leaving POS & memory leak investigation [Woo POS] Cancel payment after leaving POS Feb 19, 2025
@staskus staskus requested a review from joshheald February 19, 2025 15:31
@staskus staskus marked this pull request as ready for review February 19, 2025 15:32
@staskus staskus marked this pull request as draft February 19, 2025 15:34
@staskus staskus force-pushed the fix/15180-memory-leaks branch from 4a24a70 to 7420830 Compare February 19, 2025 15:41

@MainActor
func cancelPayment() async throws {
let cancelPaymentTask: () -> Void = cancelPayment
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 cannot call cancelPayment here without confusing the compiler

@staskus staskus marked this pull request as ready for review February 19, 2025 15:42
@joshheald joshheald self-assigned this Feb 19, 2025
@joshheald joshheald changed the base branch from trunk to issue/15180-mitigate-payment-issues-caused-by-pos-memory-leaks February 20, 2025 12:58
Base automatically changed from issue/15180-mitigate-payment-issues-caused-by-pos-memory-leaks to trunk February 20, 2025 14:28
@joshheald joshheald merged commit c4f0fb7 into trunk Feb 20, 2025
17 checks passed
@joshheald joshheald deleted the fix/15180-memory-leaks branch February 20, 2025 14:29
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.

[Woo POS] Payments aren't cancelled when leaving POS

4 participants