Utilize re-entrant locking for in app payments instead of synchronized blocks.

This commit is contained in:
Alex Hart
2024-11-08 10:48:03 -04:00
committed by Greyson Parrelli
parent a79b4c3ba0
commit ed24fd0c4b
16 changed files with 61 additions and 25 deletions

View File

@@ -9,6 +9,8 @@ import org.signal.donations.InAppPaymentType
import org.thoughtcrime.securesms.database.model.databaseprotos.InAppPaymentData
import org.whispersystems.signalservice.api.subscriptions.SubscriberId
import java.util.Currency
import java.util.concurrent.locks.Lock
import java.util.concurrent.locks.ReentrantLock
/**
* Represents a SubscriberId and metadata that can be used for a recurring
@@ -24,7 +26,7 @@ data class InAppPaymentSubscriberRecord(
/**
* Serves as the mutex by which to perform mutations to subscriptions.
*/
enum class Type(val code: Int, val jobQueue: String, val inAppPaymentType: InAppPaymentType) {
enum class Type(val code: Int, val jobQueue: String, val inAppPaymentType: InAppPaymentType, val lock: Lock = ReentrantLock()) {
/**
* A recurring donation
*/