@@ -322,27 +322,27 @@ def attempt_request(attempt):
322
322
except OSError as err :
323
323
error = err
324
324
error_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
+ ]
325
340
326
341
gos_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 :
328
344
retry_delay = bound_retry_delay (attempt , self ._retry_delay_default )
329
345
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
-
346
346
# fmt: on
347
347
log_string = f"{ gos_name } failed with code { err .errno } and will attempt to retry"
348
348
if err .errno in info_errs :
0 commit comments