From 09517837ba046653e314162d59594ce26c03a6bf Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Tue, 27 Jun 2023 12:59:43 +0200 Subject: [PATCH] IdempotencyMiddleware: Require a durable transaction --- src/pretix/api/middleware.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pretix/api/middleware.py b/src/pretix/api/middleware.py index daa2c3e618..9d21ac36e5 100644 --- a/src/pretix/api/middleware.py +++ b/src/pretix/api/middleware.py @@ -59,7 +59,7 @@ class IdempotencyMiddleware: auth_hash = sha1(auth_hash_parts.encode()).hexdigest() idempotency_key = request.headers.get('X-Idempotency-Key', '') - with transaction.atomic(): + with transaction.atomic(durable=True): call, created = ApiCall.objects.select_for_update(of=OF_SELF).get_or_create( auth_hash=auth_hash, idempotency_key=idempotency_key, @@ -75,7 +75,7 @@ class IdempotencyMiddleware: if created: resp = self.get_response(request) - with transaction.atomic(): + with transaction.atomic(durable=True): if resp.status_code in (409, 429, 500, 503): # This is the exception: These calls are *meant* to be retried! call.delete()