Add EPP retry on transport errors

This commit is contained in:
Erin 2023-12-06 12:24:36 -08:00
parent 4a25642d8d
commit bba5e8affb
No known key found for this signature in database
GPG key ID: 1CAD275313C62460

View file

@ -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