Skip to content

Commit

Permalink
Update TimeOut assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
QilongTang committed Sep 20, 2024
1 parent abe57dd commit e8cef07
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/GregClient/GregClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ private RestResponse ExecuteInternal(Request m)
if (timeoutSetting != null)
{
// Timeout App Settings is in seconds.
// RestRequest.Timeout is in milliseconds.
// RestRequest.Timeout is now timespan object for clarity from RestSharp 112.0.0
var userVal = Convert.ToInt32(timeoutSetting);
// Sanity check.
if (userVal >= 0 && userVal < 86400/*24 hours*/)
{
req.Timeout = Convert.ToInt32(timeoutSetting) * 1000;// get milliseconds
req.Timeout = TimeSpan.FromSeconds(userVal);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/GregClient/Requests/JSONRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public abstract class JsonRequest : Request
// Ex: Timeout property
internal void InitReqParams(ref RestRequest request)
{
request.Timeout = Timeout;
request.Timeout = TimeSpan.FromMilliseconds(Timeout);
}

internal override void Build(ref RestRequest request)
Expand Down

0 comments on commit e8cef07

Please sign in to comment.