Skip to content

Commit

Permalink
Added TimeOutInSeconds property and GetTimeOutTimeSpan method
Browse files Browse the repository at this point in the history
Added field, property, and method to support the timeout being specified in second instead of minutes.  Minutes are not sufficiently granular.
  • Loading branch information
steve-sweitzer authored Oct 14, 2024
1 parent bd9a114 commit 33385cd
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion src/UserConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ namespace Avalara.AvaTax.RestClient
public class UserConfiguration
{
private int _timeOutInMinutes;
private int _timeOutInSeconds;
private int _maxRetryAttempts;

/// <summary>
Expand All @@ -20,6 +21,26 @@ public int TimeoutInMinutes
}
}

/// <summary>
/// Gets or sets timeout in seconds. If set to a non-zero value, overrides TimeoutInMinutes.
/// </summary>
public int TimeoutInSeconds
{
get { return _timeOutInSeconds; }
set
{
_timeOutInSeconds = value <= 0 ? 0 : value;
}
}

/// <summary>
/// Get <see cref="TimeSpan"/> for the currently set timeout period.
/// </summary>
public TimeSpan GetTimeOutTimeSpan()
{
return _timeOutInSeconds > 0 ? TimeSpan.FromSeconds(_timeOutInSeconds) : TimeSpan.FromMinutes(_timeOutInMinutes);
}

/// <summary>
/// Gets or sets Maximum retry attempts
/// </summary>
Expand All @@ -39,6 +60,7 @@ public UserConfiguration()
{
this._maxRetryAttempts = 0;
this._timeOutInMinutes = 20;
this._timeOutInSeconds = 0;
}
}
}
}

0 comments on commit 33385cd

Please sign in to comment.