| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | using System; |
| | 5 | |
|
| | 6 | | namespace Azure.Core |
| | 7 | | { |
| | 8 | | /// <summary> |
| | 9 | | /// The set of options that can be specified to influence how |
| | 10 | | /// retry attempts are made, and a failure is eligible to be retried. |
| | 11 | | /// </summary> |
| | 12 | | public class RetryOptions |
| | 13 | | { |
| 94 | 14 | | internal RetryOptions() |
| | 15 | | { |
| 94 | 16 | | } |
| | 17 | |
|
| | 18 | | /// <summary> |
| | 19 | | /// The maximum number of retry attempts before giving up. |
| | 20 | | /// </summary> |
| 154 | 21 | | public int MaxRetries { get; set; } = 3; |
| | 22 | |
|
| | 23 | | /// <summary> |
| | 24 | | /// The delay between retry attempts for a fixed approach or the delay |
| | 25 | | /// on which to base calculations for a backoff-based approach. |
| | 26 | | /// </summary> |
| 170 | 27 | | public TimeSpan Delay { get; set; } = TimeSpan.FromSeconds(0.8); |
| | 28 | |
|
| | 29 | | /// <summary> |
| | 30 | | /// The maximum permissible delay between retry attempts. |
| | 31 | | /// </summary> |
| 0 | 32 | | public TimeSpan MaxDelay { get; set; } = TimeSpan.FromMinutes(1); |
| | 33 | |
|
| | 34 | | /// <summary> |
| | 35 | | /// The approach to use for calculating retry delays. |
| | 36 | | /// </summary> |
| 154 | 37 | | public RetryMode Mode { get; set; } = RetryMode.Exponential; |
| | 38 | |
|
| | 39 | | /// <summary> |
| | 40 | | /// The timeout applied to an individual network operations. |
| | 41 | | /// </summary> |
| 166 | 42 | | public TimeSpan NetworkTimeout { get; set; } = TimeSpan.FromSeconds(100); |
| | 43 | | } |
| | 44 | | } |