-
Notifications
You must be signed in to change notification settings - Fork 533
Expand file tree
/
Copy pathSessionRetryOptions.cs
More file actions
43 lines (38 loc) · 2.15 KB
/
SessionRetryOptions.cs
File metadata and controls
43 lines (38 loc) · 2.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// ------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// ------------------------------------------------------------
namespace Microsoft.Azure.Cosmos
{
using System;
using Microsoft.Azure.Documents;
/// <summary>
/// Implementation of ISessionRetryOptions interface, do not want clients to subclass.
/// </summary>
internal sealed class SessionRetryOptions : ISessionRetryOptions
{
/// <summary>
/// Initializes a new instance of the <see cref="SessionRetryOptions"/> class.
/// </summary>
public SessionRetryOptions()
{
this.MinInRegionRetryTime = ConfigurationManager.GetMinRetryTimeInLocalRegionWhenRemoteRegionPreferred();
this.MaxInRegionRetryCount = ConfigurationManager.GetMaxRetriesInLocalRegionWhenRemoteRegionPreferred();
}
/// <summary>
/// Sets the minimum retry time for 404/1002 retries within each region for read and write operations.
/// The minimum value is 100ms - this minimum is enforced to provide a way for the local region to catch-up on replication lag. The default value is 500ms - as a recommendation ensure that this value is higher than the steady-state
/// replication latency between the regions you chose
/// </summary>
public TimeSpan MinInRegionRetryTime { get; private set; }
/// <summary>
/// Sets the maximum number of retries within each region for read and write operations - the backoff time for the last in-region retry will ensure that the total retry time within the
/// region is at least the min. in-region retry time.
/// </summary>
public int MaxInRegionRetryCount { get; internal set; }
/// <summary>
/// hints which guide SDK-internal retry policies on how early to switch retries to a different region. If true, will retry all replicas once and add a minimum delay before switching to the next region.If false, it will
/// retry in the local region up to 5s
/// </summary>
public bool RemoteRegionPreferred { get; set; } = false;
}
}