Skip to content

Commit 69477d2

Browse files
refactoring Retry Example
1 parent 1c10fc7 commit 69477d2

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

Example Projects/dotNetCoreExample/Examples/Basic/BasicSendWithRetry.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public SendResponse RunExample()
1515
{
1616
EndpointUrl = ExampleConfig.TargetApi,
1717
RequestTimeout = 120,
18-
RetrySettings = new RetrySettings(3, TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(5))
18+
NumberOfRetries = 3
1919
};
2020

2121
var message = new BasicMessage();

src/SocketLabs/InjectionApi/RetrySettings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace SocketLabs.InjectionApi
55
/// <summary>
66
///
77
/// </summary>
8-
public class RetrySettings
8+
internal class RetrySettings
99
{
1010

1111
private const int _defaultNumberOfRetries = 0;

src/SocketLabs/InjectionApi/SocketLabsClient.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public class SocketLabsClient : ISocketLabsClient, IDisposable
5252
/// <summary>
5353
/// RetrySettings object to define retry setting for the Injection API request.
5454
/// </summary>
55-
public RetrySettings RetrySettings { get; set; } = new RetrySettings();
55+
public int NumberOfRetries { get; set; } = 0;
5656

5757
/// <summary>
5858
/// Creates a new instance of the <c>SocketLabsClient</c>.
@@ -240,7 +240,7 @@ public async Task<SendResponse> SendAsync(IBasicMessage message, CancellationTok
240240

241241
_httpClient.Timeout = TimeSpan.FromSeconds(RequestTimeout);
242242

243-
var retryHandler = new RetryHandler(_httpClient, EndpointUrl, RetrySettings);
243+
var retryHandler = new RetryHandler(_httpClient, EndpointUrl, new RetrySettings(NumberOfRetries));
244244
var httpResponse = await retryHandler.SendAsync(json, cancellationToken);
245245

246246
var response = new InjectionResponseParser().Parse(httpResponse);
@@ -295,7 +295,7 @@ public async Task<SendResponse> SendAsync(IBulkMessage message, CancellationToke
295295

296296
_httpClient.Timeout = TimeSpan.FromSeconds(RequestTimeout);
297297

298-
var retryHandler = new RetryHandler(_httpClient, EndpointUrl, RetrySettings);
298+
var retryHandler = new RetryHandler(_httpClient, EndpointUrl, new RetrySettings(NumberOfRetries));
299299
var httpResponse = await retryHandler.SendAsync(json, cancellationToken);
300300

301301
var response = new InjectionResponseParser().Parse(httpResponse);

0 commit comments

Comments
 (0)