mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-05-19 02:49:21 +02:00
Add EPP retry on transport errors
This commit is contained in:
parent
4a25642d8d
commit
bba5e8affb
1 changed files with 2 additions and 5 deletions
|
@ -158,16 +158,13 @@ class EPPLibWrapper:
|
||||||
# The end user will need to recall .send.
|
# The end user will need to recall .send.
|
||||||
self.start_connection_pool()
|
self.start_connection_pool()
|
||||||
|
|
||||||
counter = 0 # we'll try 3 times
|
counter = 0
|
||||||
logger.info("Counter set to: ", counter)
|
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
logger.info("Trying self._send(command)")
|
|
||||||
return self._send(command)
|
return self._send(command)
|
||||||
except RegistryError as err:
|
except RegistryError as err:
|
||||||
logger.info("Exception found")
|
|
||||||
if counter < 3 and (err.should_retry() or err.is_transport_error()):
|
if counter < 3 and (err.should_retry() or err.is_transport_error()):
|
||||||
logger.info("Retrying transport error. Attempt #", counter)
|
logger.info(f"Retrying transport error. Attempt #{counter+1} of 3.")
|
||||||
counter += 1
|
counter += 1
|
||||||
sleep((counter * 50) / 1000) # sleep 50 ms to 150 ms
|
sleep((counter * 50) / 1000) # sleep 50 ms to 150 ms
|
||||||
else: # don't try again
|
else: # don't try again
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue