PaymentBackend: skip poll faster if there is no transaction (#66487)
This commit is contained in:
parent
8492dc2403
commit
22daaad4ef
|
@ -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():
|
||||
|
|
Loading…
Reference in New Issue