@@ -322,27 +322,27 @@ def attempt_request(attempt):
322322except OSError as err :
323323error = err
324324error_message = str (err )
325+ # fmt: off
326+ # The built-in errno package encapsulates OSError codes, which are OS-specific.
327+ # log.info for errors we believe are not unusual or unexpected. log.warn for
328+ # for others like EEXIST, EBADF, ERANGE which are not expected in this context.
329+ #
330+ # I manually tested this retry behaviour using mitmweb and confirmed that
331+ # GetOperationStatus requests are retried when I forced network connection
332+ # interruptions / timeouts / reconnects. See #24 for more info.
333+ # | Debian | Darwin |
334+ info_errs = [# |--------|--------|
335+ errno .ESHUTDOWN ,# | 32 | 32 |
336+ errno .EAFNOSUPPORT ,# | 97 | 47 |
337+ errno .ECONNRESET ,# | 104 | 54 |
338+ errno .ETIMEDOUT ,# | 110 | 60 |
339+ ]
325340
326341gos_name = TCLIServiceClient .GetOperationStatus .__name__
327- if method .__name__ == gos_name :
342+ # retry on timeout. Happens a lot in Azure and it is safe as data has not been sent to server yet
343+ if method .__name__ == gos_name or err .errno == errno .ETIMEDOUT :
328344retry_delay = bound_retry_delay (attempt ,self ._retry_delay_default )
329345
330- # fmt: off
331- # The built-in errno package encapsulates OSError codes, which are OS-specific.
332- # log.info for errors we believe are not unusual or unexpected. log.warn for
333- # for others like EEXIST, EBADF, ERANGE which are not expected in this context.
334- #
335- # I manually tested this retry behaviour using mitmweb and confirmed that
336- # GetOperationStatus requests are retried when I forced network connection
337- # interruptions / timeouts / reconnects. See #24 for more info.
338- # | Debian | Darwin |
339- info_errs = [# |--------|--------|
340- errno .ESHUTDOWN ,# | 32 | 32 |
341- errno .EAFNOSUPPORT ,# | 97 | 47 |
342- errno .ECONNRESET ,# | 104 | 54 |
343- errno .ETIMEDOUT ,# | 110 | 60 |
344- ]
345-
346346# fmt: on
347347log_string = f"{ gos_name } failed with code{ err .errno } and will attempt to retry"
348348if err .errno in info_errs :