Skip to content

Commit

Permalink
Wrap CancellationTokenSource in using #1685
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeyzimarev committed Jan 7, 2022
1 parent c17f0df commit 3e36e84
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/RestSharp/RestClient.Async.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ async Task<InternalResponse> ExecuteInternal(RestRequest request, CancellationTo
message.Headers.Host = Options.BaseHost;
message.Headers.CacheControl = Options.CachePolicy;

var timeoutCts = new CancellationTokenSource(request.Timeout > 0 ? request.Timeout : int.MaxValue);
var cts = CancellationTokenSource.CreateLinkedTokenSource(timeoutCts.Token, cancellationToken);
var ct = cts.Token;
using var timeoutCts = new CancellationTokenSource(request.Timeout > 0 ? request.Timeout : int.MaxValue);
using var cts = CancellationTokenSource.CreateLinkedTokenSource(timeoutCts.Token, cancellationToken);
var ct = cts.Token;

try {
var headers = new RequestHeaders()
Expand Down

0 comments on commit 3e36e84

Please sign in to comment.