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

Drop Task-based execute methods #1194

Merged
merged 2 commits into from
May 18, 2023
Merged

Conversation

martintmk
Copy link
Contributor

@martintmk martintmk commented May 18, 2023

Details on the issue fix or feature implementation

After taking a look at this API together we concluded that having ExecuteAsync and ExecuteValueTaskAsync is weird and is to better just expose the native ValueTask based methods.

The downside is the following scenario:

ResilienceStrategy strategy = ...
await strategy.ExecuteAsync(MyExecute);

private async Task MyExecuteAsync(Cancellation token)
{
   // do something
}

However, the caller might as well just do:

ResilienceStrategy strategy = ...
strategy.ExecuteAsync(async cancellationToken => await MyExecute(cancellationToken));

Wdyt, it's ok to drop these?

Confirm the following

  • I started this PR by branching from the head of the default branch
  • I have targeted the PR to merge into the default branch
  • I have included unit tests for the issue/feature
  • I have successfully run a local build

@martintmk martintmk added the v8 Issues related to the new version 8 of the Polly library. label May 18, 2023
@martintmk martintmk added this to the v8.0.0 milestone May 18, 2023
@martintmk martintmk requested a review from martincostello May 18, 2023 09:37
@martintmk martintmk enabled auto-merge (squash) May 18, 2023 09:40
@codecov-commenter
Copy link

codecov-commenter commented May 18, 2023

Codecov Report

Merging #1194 (2681445) into main (a4343b7) will decrease coverage by 0.25%.
The diff coverage is n/a.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

@@            Coverage Diff             @@
##             main    #1194      +/-   ##
==========================================
- Coverage   83.44%   83.19%   -0.25%     
==========================================
  Files         275      273       -2     
  Lines        6336     6242      -94     
  Branches     1031     1025       -6     
==========================================
- Hits         5287     5193      -94     
  Misses        844      844              
  Partials      205      205              
Flag Coverage Δ
macos 83.19% <ø> (-0.25%) ⬇️
windows 83.19% <ø> (-0.25%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...c/Polly.Core/ResilienceStrategy.Async.ValueTask.cs 100.00% <ø> (ø)
.../Polly.Core/ResilienceStrategy.Async.ValueTaskT.cs 100.00% <ø> (ø)

@martintmk martintmk merged commit ee2a4f5 into main May 18, 2023
@martintmk martintmk deleted the mtomka/drop-task-execute-methods branch May 18, 2023 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v8 Issues related to the new version 8 of the Polly library.
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants