Skip to content

Commit

Permalink
Log retries.
Browse files Browse the repository at this point in the history
  • Loading branch information
alecpm committed Nov 26, 2024
1 parent 759dc08 commit 2cd1e9c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion jazkarta/shop/browser/checkout/authorize_net_accept_js.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from ...utils import resolve_uid
from ...utils import run_in_transaction
from ...validators import is_email
from ... import logger

SUBSCRIPTION_SLEEP_INCREMENT = 2
SUBSCRIPTION_RETRIES = 4
Expand Down Expand Up @@ -69,7 +70,12 @@ def retry_subscription_request(self, opaque_data, contact_info):
raise e
# Retry after delay for specific error
if 'Invalid OTS Token' in str(e):
time.sleep(SUBSCRIPTION_SLEEP_INCREMENT * self.retries)
delay = SUBSCRIPTION_SLEEP_INCREMENT * self.retries
logger.warn(
"Error on Auth.net subscription request. Retrying "
"({}) after {} seconds".format(self.retries, delay)
)
time.sleep(delay)
continue
# Raise the error for any other error
raise e
Expand Down

0 comments on commit 2cd1e9c

Please sign in to comment.