From 0c0053f094a8f03c03dde7bb8b0a908766747e29 Mon Sep 17 00:00:00 2001 From: Alan Doherty Date: Wed, 21 Nov 2018 14:14:13 +0000 Subject: [PATCH] Added some no-capture Awaitable configuration --- src/WifiPlug.Api/ApiClient.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/WifiPlug.Api/ApiClient.cs b/src/WifiPlug.Api/ApiClient.cs index b493f79..8ae8299 100644 --- a/src/WifiPlug.Api/ApiClient.cs +++ b/src/WifiPlug.Api/ApiClient.cs @@ -137,14 +137,14 @@ public Uri BaseAddress { for (int i = 0; i < _retryCount; i++) { try { - return await RawRequestAsync(method, path, content, cancellationToken); + return await RawRequestAsync(method, path, content, cancellationToken).ConfigureAwait(false); } catch(ApiException ex) { if (ex.StatusCode == HttpStatusCode.BadGateway && i < _retryCount - 1) { - await Task.Delay(_retryDelay, cancellationToken); + await Task.Delay(_retryDelay, cancellationToken).ConfigureAwait(false); continue; } else if (ex.StatusCode == HttpStatusCode.Unauthorized && _authentication != null && !hasReauthorised) { // try and reauthorize - bool success = await _authentication.ReauthorizeAsync(this); + bool success = await _authentication.ReauthorizeAsync(this).ConfigureAwait(false); // if we're successful we don't count this as a retry, note that we store this // this prevents an infinite loop and gives us retryCount + 1 if we had to reauthorise @@ -413,7 +413,7 @@ await RequestAsync(method, path, content, cancellationToken).ConfigureAwait(fals /// The cancellation token. /// The ping response. public async Task PingAsync(CancellationToken cancellationToken = default(CancellationToken)) { - return await (await RequestAsync(HttpMethod.Get, "ping", null, cancellationToken)).Content.ReadAsStringAsync(); + return await (await RequestAsync(HttpMethod.Get, "ping", null, cancellationToken).ConfigureAwait(false)).Content.ReadAsStringAsync().ConfigureAwait(false); } #endregion