Skip to content

Commit 141dc69

Browse files
committed
Cancel payment task when disconnecting reader
If reader is disconnected while the payment is already being collected, then task never finishes. It could cause memory leaks due to stalled Tasks
1 parent 7220b7b commit 141dc69

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

WooCommerce/Classes/POS/Card Present Payments/CardPresentPaymentService.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ final class CardPresentPaymentService: CardPresentPaymentFacade {
108108
DDLogError("Attempting to cancel the payment has failed \(error)")
109109
}
110110

111+
paymentTask?.cancel()
111112
connectionControllerManager.knownReaderProvider.forgetCardReader()
112113

113114
return await withCheckedContinuation { continuation in

0 commit comments

Comments
 (0)