Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove some redundant async state machines #985

Merged
merged 7 commits into from
Jan 7, 2023
Prev Previous commit
Next Next commit
Merge branch 'main' into remove-some-redundant-async-state-machines-
SimonCropp committed Jan 7, 2023
commit 27777d0c0a4f08f395a926411913abf664bb8583
50 changes: 25 additions & 25 deletions src/Polly/Wrap/AsyncPolicyWrapEngine.cs
Original file line number Diff line number Diff line change
@@ -6,99 +6,99 @@ namespace Polly.Wrap;

internal static class AsyncPolicyWrapEngine
{
internal static Task<TResult> ImplementationAsync<TResult>(
internal static async Task<TResult> ImplementationAsync<TResult>(
Func<Context, CancellationToken, Task<TResult>> func,
Context context,
CancellationToken cancellationToken,
bool continueOnCapturedContext,
IAsyncPolicy<TResult> outerPolicy,
IAsyncPolicy<TResult> innerPolicy)
=> outerPolicy.ExecuteAsync(
(ctx, ct) => innerPolicy.ExecuteAsync(
=> await outerPolicy.ExecuteAsync(
async (ctx, ct) => await innerPolicy.ExecuteAsync(
func,
ctx,
ct,
continueOnCapturedContext
),
).ConfigureAwait(continueOnCapturedContext),
context,
cancellationToken,
continueOnCapturedContext
);
).ConfigureAwait(continueOnCapturedContext);

internal static Task<TResult> ImplementationAsync<TResult>(
internal static async Task<TResult> ImplementationAsync<TResult>(
Func<Context, CancellationToken, Task<TResult>> func,
Context context,
CancellationToken cancellationToken,
bool continueOnCapturedContext,
IAsyncPolicy<TResult> outerPolicy,
IAsyncPolicy innerPolicy)
=> outerPolicy.ExecuteAsync(
(ctx, ct) => innerPolicy.ExecuteAsync<TResult>(
=> await outerPolicy.ExecuteAsync(
async (ctx, ct) => await innerPolicy.ExecuteAsync<TResult>(
func,
ctx,
ct,
continueOnCapturedContext
),
).ConfigureAwait(continueOnCapturedContext),
context,
cancellationToken,
continueOnCapturedContext
);
).ConfigureAwait(continueOnCapturedContext);

internal static Task<TResult> ImplementationAsync<TResult>(
internal static async Task<TResult> ImplementationAsync<TResult>(
Func<Context, CancellationToken, Task<TResult>> func,
Context context,
CancellationToken cancellationToken,
bool continueOnCapturedContext,
IAsyncPolicy outerPolicy,
IAsyncPolicy<TResult> innerPolicy)
=> outerPolicy.ExecuteAsync<TResult>(
(ctx, ct) => innerPolicy.ExecuteAsync(
=> await outerPolicy.ExecuteAsync<TResult>(
async (ctx, ct) => await innerPolicy.ExecuteAsync(
func,
ctx,
ct,
continueOnCapturedContext
),
).ConfigureAwait(continueOnCapturedContext),
context,
cancellationToken,
continueOnCapturedContext
);
).ConfigureAwait(continueOnCapturedContext);

internal static Task<TResult> ImplementationAsync<TResult>(
internal static async Task<TResult> ImplementationAsync<TResult>(
Func<Context, CancellationToken, Task<TResult>> func,
Context context,
CancellationToken cancellationToken,
bool continueOnCapturedContext,
IAsyncPolicy outerPolicy,
IAsyncPolicy innerPolicy)
=> outerPolicy.ExecuteAsync<TResult>(
(ctx, ct) => innerPolicy.ExecuteAsync<TResult>(
=> await outerPolicy.ExecuteAsync<TResult>(
async (ctx, ct) => await innerPolicy.ExecuteAsync<TResult>(
func,
ctx,
ct,
continueOnCapturedContext
),
).ConfigureAwait(continueOnCapturedContext),
context,
cancellationToken,
continueOnCapturedContext
);
).ConfigureAwait(continueOnCapturedContext);

internal static Task ImplementationAsync(
internal static async Task ImplementationAsync(
Func<Context, CancellationToken, Task> action,
Context context,
CancellationToken cancellationToken,
bool continueOnCapturedContext,
IAsyncPolicy outerPolicy,
IAsyncPolicy innerPolicy)
=> outerPolicy.ExecuteAsync(
(ctx, ct) => innerPolicy.ExecuteAsync(
=> await outerPolicy.ExecuteAsync(
async (ctx, ct) => await innerPolicy.ExecuteAsync(
action,
ctx,
ct,
continueOnCapturedContext
),
).ConfigureAwait(continueOnCapturedContext),
context,
cancellationToken,
continueOnCapturedContext
);
).ConfigureAwait(continueOnCapturedContext);

}
You are viewing a condensed version of this merge commit. You can view the full changes here.