Apply suggestions from code review

Co-authored-by: Raphael Michel <michel@rami.io>
This commit is contained in:
luelista
2025-07-01 14:31:14 +02:00
committed by Mira Weller
parent 41fcc2a606
commit 23565f20b6
6 changed files with 33 additions and 12 deletions

View File

@@ -245,6 +245,9 @@ class OutboundSyncProvider:
sq.in_flight_since = now()
sq.save()
except DatabaseError:
# Either select_for_update failed to lock the row, or we couldn't set in_flight
# as this order is already in flight (UNIQUE violation). In either case, we ignore
# this order for now.
continue
try:
mapped_objects = self.sync_order(sq.order)

View File

@@ -51,7 +51,7 @@ class OrderSyncQueue(models.Model):
not_before = models.DateTimeField(blank=False, null=False, db_index=True)
need_manual_retry = models.CharField(blank=True, null=True, max_length=20, choices=[
('exceeded', _('Temporary error, auto-retry limit exceeded')),
('permanent', _('Misconfiguration, please check provider settings')),
('permanent', _('Provider reported a permanent error')),
('config', _('Misconfiguration, please check provider settings')),
('internal', _('System error, needs manual intervention')),
('timeout', _('System error, needs manual intervention')),