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

Updates for beta.1 #1531

Merged
merged 3 commits into from
Aug 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## 8.0.0-beta.1

* Updates for alpha.9 by [@martincostello](https://github.com/martincostello) in https://github.com/App-vNext/Polly/pull/1526
* Finalize the API review by [@martintmk](https://github.com/martintmk) in https://github.com/App-vNext/Polly/pull/1528
* Disposing pipeline should not dispose external inner pipeline by [@martintmk](https://github.com/martintmk) in https://github.com/App-vNext/Polly/pull/1529
* Clean duplications around disposing the pipelines by [@martintmk](https://github.com/martintmk) in https://github.com/App-vNext/Polly/pull/1530

## 8.0.0-alpha.9

* Updates for alpha.8 by [@martincostello](https://github.com/martincostello) in https://github.com/App-vNext/Polly/pull/1465
Expand Down
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<MicrosoftExtensionsVersion>7.0.0</MicrosoftExtensionsVersion>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<PollyVersion>8.0.0-alpha.9</PollyVersion>
<PollyVersion>8.0.0-beta.1</PollyVersion>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="coverlet.msbuild" Version="6.0.0" />
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
> Major performance improvements are on the way! Please see our [blog post](https://www.thepollyproject.org/2023/03/03/we-want-your-feedback-introducing-polly-v8/) to learn more and provide feedback in the [related GitHub issue](https://github.com/App-vNext/Polly/issues/1048).
>
> :rotating_light::rotating_light: **Polly v8 feature-complete!** :rotating_light::rotating_light:
> - Polly v8 Alpha 9 is now available on [NuGet.org](https://www.nuget.org/packages/Polly/8.0.0-alpha.9)
> - The Alpha 9 version is considered feature-complete. After completing [review of the API](https://github.com/App-vNext/Polly/pull/1233) to address unresolved issues, we will move on to a Beta release.
> - Polly v8 Beta 1 is now available on [NuGet.org](https://www.nuget.org/packages/Polly/8.0.0-beta.1)
martintmk marked this conversation as resolved.
Show resolved Hide resolved
> - The Beta 1 version is considered feature-complete and the public API surface is stable.
> - The v8 docs are not yet finished, but you can take a look at sample code in these locations:
> - Within the repo's new [Samples folder](https://github.com/App-vNext/Polly/tree/main/samples)
> - By reading `Polly.Core`'s [README](https://github.com/App-vNext/Polly/blob/main/src/Polly.Core/README.md)
Expand Down
8 changes: 4 additions & 4 deletions samples/GenericStrategies/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
FallbackAction = _ =>
{
// Return fallback result
return Outcome.FromResultAsTask(new HttpResponseMessage(HttpStatusCode.OK));
return Outcome.FromResultAsValueTask(new HttpResponseMessage(HttpStatusCode.OK));
},
// You can also use switch expressions for succinct syntax
ShouldHandle = arguments => arguments.Outcome switch
{
// The "PredicateResult.True" is shorthand to "new ValueTask<bool>(true)"
{ Exception: HttpRequestException } => PredicateResult.True,
{ Result: HttpResponseMessage response } when response.StatusCode == HttpStatusCode.InternalServerError => PredicateResult.True,
_ => PredicateResult.False
{ Exception: HttpRequestException } => PredicateResult.True(),
{ Result: HttpResponseMessage response } when response.StatusCode == HttpStatusCode.InternalServerError => PredicateResult.True(),
_ => PredicateResult.False()
},
OnFallback = _ =>
{
Expand Down
4 changes: 2 additions & 2 deletions samples/Intro/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@
// To configure the predicate you can use switch expressions
ShouldHandle = args => args.Outcome.Exception switch
{
TimeoutRejectedException => PredicateResult.True,
TimeoutRejectedException => PredicateResult.True(),

// The "PredicateResult.False" is just shorthand for "new ValueTask<bool>(true)"
// You can also use "new PredicateBuilder().Handle<TimeoutRejectedException>()"
_ => PredicateResult.False
_ => PredicateResult.False()
},
// Register user callback called whenever retry occurs
OnRetry = args =>
Expand Down
8 changes: 4 additions & 4 deletions samples/Retries/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@
// Specify what exceptions should be retried using switch expressions
ShouldHandle = args => args.Outcome.Exception switch
{
InvalidOperationException => PredicateResult.True,
_ => PredicateResult.False,
InvalidOperationException => PredicateResult.True(),
_ => PredicateResult.False(),
},
OnRetry = outcome =>
{
Expand Down Expand Up @@ -82,11 +82,11 @@
arguments.Outcome.Result.Headers.TryGetValues("Retry-After", out var value))
{
// Return delay based on header
return new ValueTask<TimeSpan>(TimeSpan.FromSeconds(int.Parse(value.Single())));
return new ValueTask<TimeSpan?>(TimeSpan.FromSeconds(int.Parse(value.Single())));
}

// Return delay hinted by the retry strategy
return new ValueTask<TimeSpan>(arguments.DelayHint);
return new ValueTask<TimeSpan?>(default(TimeSpan?));
}
})
.Build();
Expand Down