Optimizing async tasks (ConfigureAwait(false))
This commit is contained in:
@@ -66,8 +66,8 @@ namespace Microsoft.AspNetCore.Mvc.Filters
|
||||
if (string.IsNullOrWhiteSpace(privateKey))
|
||||
return;
|
||||
|
||||
await DoValidation(context);
|
||||
await base.OnActionExecutionAsync(context, next);
|
||||
await DoValidation(context).ConfigureAwait(false);
|
||||
await base.OnActionExecutionAsync(context, next).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private async Task DoValidation(ActionExecutingContext context)
|
||||
@@ -82,7 +82,7 @@ namespace Microsoft.AspNetCore.Mvc.Filters
|
||||
return;
|
||||
}
|
||||
|
||||
await Validate(context, token);
|
||||
await Validate(context, token).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private async Task Validate(ActionExecutingContext context, string token)
|
||||
@@ -93,8 +93,8 @@ namespace Microsoft.AspNetCore.Mvc.Filters
|
||||
{ "secret", privateKey },
|
||||
{ "response", token }
|
||||
};
|
||||
var response = await httpClient.PostAsync(VerificationUrl, new FormUrlEncodedContent(param));
|
||||
string json = await response.Content.ReadAsStringAsync();
|
||||
var response = await httpClient.PostAsync(VerificationUrl, new FormUrlEncodedContent(param)).ConfigureAwait(false);
|
||||
string json = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
|
||||
|
||||
var result = JsonConvert.DeserializeObject<Response>(json);
|
||||
if (result?.Success != true)
|
||||
|
||||
Reference in New Issue
Block a user