diff --git a/combo/apps/lingo/models.py b/combo/apps/lingo/models.py index 03318c81..c214f718 100644 --- a/combo/apps/lingo/models.py +++ b/combo/apps/lingo/models.py @@ -257,6 +257,9 @@ class PaymentBackend(models.Model): status__in=Transaction.RUNNING_STATUSES, ).order_by('pk') last_pk = -1 + # skip fast in order to save some resources on database + if not transactions.exists(): + return while True: # lock each transaction before trying to poll it with atomic():