Skip to content

Commit

Permalink
elide Task.FromResult asyncs (#9997)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonCropp authored Jun 22, 2024
1 parent a9a79ac commit 53004f0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ public static IAsyncPolicy<HttpResponseMessage> SearchClientFallBackCircuitBreak
.OrResult(r => r.StatusCode == HttpStatusCode.Forbidden)
.Or<Exception>()
.FallbackAsync(
fallbackAction: async (context, cancellationToken) =>
fallbackAction: (context, cancellationToken) =>
{
return await Task.FromResult(new HttpResponseMessage()
return Task.FromResult(new HttpResponseMessage()
{
Content = new StringContent(Strings.SearchServiceIsNotAvailable),
StatusCode = HttpStatusCode.ServiceUnavailable
Expand Down
8 changes: 4 additions & 4 deletions tests/NuGetGallery.Facts/Services/StatusServiceFacts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,10 @@ public CloudStorageStatusDependencyIsAvailable(IAppConfiguration config)
_config = config;
}

public async Task<bool> IsAvailableAsync(BlobRequestOptions options, OperationContext operationContext)
public Task<bool> IsAvailableAsync(BlobRequestOptions options, OperationContext operationContext)
{
AssertConfigLocationMode(_config, options);
return await Task.FromResult(true);
return Task.FromResult(true);
}
}

Expand All @@ -189,10 +189,10 @@ public CloudStorageStatusDependencyIsNotAvailable(IAppConfiguration config)
_config = config;
}

public async Task<bool> IsAvailableAsync(BlobRequestOptions options, OperationContext operationContext)
public Task<bool> IsAvailableAsync(BlobRequestOptions options, OperationContext operationContext)
{
AssertConfigLocationMode(_config, options);
return await Task.FromResult(false);
return Task.FromResult(false);
}
}

Expand Down

0 comments on commit 53004f0

Please sign in to comment.