From 358d0baa213c00a41349cd68049859133ea15a23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 30 Jan 2019 09:45:59 +0100 Subject: [PATCH] Allow to lock records for update issue8012 review45901002 --- payment.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/payment.py b/payment.py index 38d04aa115..f7dc630a84 100644 --- a/payment.py +++ b/payment.py @@ -368,6 +368,7 @@ class Payment(metaclass=PoolMeta): or payment.journal.process_method != 'stripe' or payment.state != 'processing'): continue + payment.lock() try: charge = stripe.Charge.create(**payment._charge_parameters()) except (stripe.error.RateLimitError, @@ -446,6 +447,7 @@ class Payment(metaclass=PoolMeta): or payment.stripe_captured or payment.state != 'processing'): continue + payment.lock() try: charge = stripe.Charge.retrieve( payment.stripe_charge_id, @@ -817,6 +819,7 @@ class Customer(DeactivableMixin, ModelSQL, ModelView): for customer in customers: if customer.stripe_customer_id: continue + customer.lock() try: cu = stripe.Customer.create( api_key=customer.stripe_account.secret_key, @@ -856,6 +859,7 @@ class Customer(DeactivableMixin, ModelSQL, ModelView): ]) for customer in customers: assert not customer.active + customer.lock() try: cu = stripe.Customer.retrieve( api_key=customer.stripe_account.secret_key,