Skip to content

Commit

Permalink
Merge pull request #435 from App-vNext/v590
Browse files Browse the repository at this point in the history
Merge Polly v5.9.0 to master
joelhulen authored Apr 9, 2018

Verified

This commit was signed with the committer’s verified signature.
Kobzol Jakub Beránek
2 parents b82366f + ec59248 commit 72f59a1
Showing 85 changed files with 2,016 additions and 1,636 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 5.9.0
- Allow Timeout.InfiniteTimeSpan (no timeout) for TimeoutPolicy.
- Add .AsPolicy<TResult> and .AsAsyncPolicy<TResult> methods for converting non-generic policies to generic policies.
- Per Semver, indicates deprecation of overloads and properties intended to be removed or renamed in Polly v6.

## 5.8.0
- Add a new onBreak overload that provides the prior state on a transition to an open state
- Bug fix: RelativeTtl in CachePolicy now always returns a ttl relative to time item is cached
2 changes: 1 addition & 1 deletion GitVersionConfig.yaml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
next-version: 5.8.0
next-version: 5.9.0
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -988,6 +988,7 @@ For details of changes by release see the [change log](https://github.com/App-vN
* [@awarrenlove](https://github.com/awarrenlove) - Add ability to calculate cache Ttl based on item to cache.
* [@erickhouse](https://github.com/erickhouse) - Add a new onBreak overload that provides the prior state on a transition to an open state.
* [@benagain](https://github.com/benagain) - Bug fix: RelativeTtl in CachePolicy now always returns a ttl relative to time item is cached.
* [@urig](https://github.com/urig) - Allow TimeoutPolicy to be configured with Timeout.InfiniteTimeSpan.
# Sample Projects

2 changes: 1 addition & 1 deletion src/GlobalAssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
[assembly: AssemblyProduct("Polly")]
[assembly: AssemblyCompany("App vNext")]
[assembly: AssemblyDescription("Polly is a library that allows developers to express resilience and transient fault handling policies such as Retry, Circuit Breaker, Timeout, Bulkhead Isolation, and Fallback in a fluent and thread-safe manner.")]
[assembly: AssemblyCopyright("Copyright (c) 2017, App vNext")]
[assembly: AssemblyCopyright("Copyright (c) 2018, App vNext")]

#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
2 changes: 1 addition & 1 deletion src/Polly.Net40Async.Specs/readme.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
This project exists to test Polly.Net40Async.csproj.

Polly.Net40Async.csproj is compiled against .NET4.5, and has to be, to use XUnit version 2.0, on which we depend. This is however a valid way of xunit-testing a .NET40 assembly. See https://github.com/xunit/xunit/issues/241#issuecomment-67725679
Polly.Net40Async.Specs.csproj is compiled against .NET4.5, and has to be, to use XUnit version 2.0, on which we depend. This is however a valid way of xunit-testing a .NET40 assembly. See https://github.com/xunit/xunit/issues/241#issuecomment-67725679
8 changes: 7 additions & 1 deletion src/Polly.Net40Async.nuspec
Original file line number Diff line number Diff line change
@@ -11,10 +11,16 @@
<iconUrl>https://raw.github.com/App-vNext/Polly/master/Polly.png</iconUrl>
<projectUrl>https://github.com/App-vNext/Polly</projectUrl>
<tags>Exception Handling Resilience Transient Fault Policy Circuit Breaker CircuitBreaker Retry Wait Cache Cache-aside Bulkhead Fallback Timeout Throttle Parallelization</tags>
<copyright>Copyright © 2017, App vNext</copyright>
<copyright>Copyright © 2018, App vNext</copyright>
<releaseNotes>
v5.0 is a major release with significant new resilience policies: Timeout; Bulkhead Isolation; Fallback; Cache; and PolicyWrap. See release notes back to v5.0.0 for full details.

5.9.0
---------------------
- Allow Timeout.InfiniteTimeSpan (no timeout) for TimeoutPolicy.
- Add .AsPolicy&lt;TResult&gt; and .AsAsyncPolicy&lt;TResult&gt; methods for converting non-generic policies to generic policies.
- Per Semver, indicates deprecation of overloads and properties intended to be removed or renamed in Polly v6.

5.8.0
---------------------
- Add a new onBreak overload that provides the prior state on a transition to an open state
2 changes: 1 addition & 1 deletion src/Polly.NetStandard11/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
using System.Runtime.CompilerServices;

[assembly: AssemblyTitle("Polly")]
[assembly: AssemblyVersion("5.8.0.0")]
[assembly: AssemblyVersion("5.9.0.0")]
[assembly: CLSCompliant(true)]

[assembly: InternalsVisibleTo("Polly.NetStandard11.Specs")]
2 changes: 1 addition & 1 deletion src/Polly.Shared/Caching/CachePolicy.cs
Original file line number Diff line number Diff line change
@@ -53,7 +53,7 @@ internal CachePolicy(
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>The value returned by the action, or the cache.</returns>
[DebuggerStepThrough]
public override TResult ExecuteInternal<TResult>(Func<Context, CancellationToken, TResult> action, Context context, CancellationToken cancellationToken)
internal override TResult ExecuteInternal<TResult>(Func<Context, CancellationToken, TResult> action, Context context, CancellationToken cancellationToken)
{
return CacheEngine.Implementation<TResult>(
_syncCacheProvider.For<TResult>(),
2 changes: 1 addition & 1 deletion src/Polly.Shared/Caching/CachePolicyAsync.cs
Original file line number Diff line number Diff line change
@@ -45,7 +45,7 @@ internal CachePolicy(
/// <param name="continueOnCapturedContext">Whether to continue on a captured synchronization context.</param>
/// <returns>The value returned by the action, or the cache.</returns>
[DebuggerStepThrough]
public override Task<TResult> ExecuteAsyncInternal<TResult>(Func<Context, CancellationToken, Task<TResult>> action, Context context, CancellationToken cancellationToken, bool continueOnCapturedContext)
internal override Task<TResult> ExecuteAsyncInternal<TResult>(Func<Context, CancellationToken, Task<TResult>> action, Context context, CancellationToken cancellationToken, bool continueOnCapturedContext)
{
return CacheEngine.ImplementationAsync<TResult>(
_asyncCacheProvider.AsyncFor<TResult>(),
4 changes: 2 additions & 2 deletions src/Polly.Shared/Caching/CacheSyntax.cs
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ public partial class Policy
{
/// <summary>
/// <para>Builds a <see cref="Policy"/> that will function like a result cache for delegate executions returning a result.</para>
/// <para>Before executing a delegate returning a result, checks whether the <paramref name="cacheProvider"/> holds a value for the cache key specified by <see cref="M:Context.ExecutionKey"/>.
/// <para>Before executing a delegate returning a result, checks whether the <paramref name="cacheProvider"/> holds a value for the cache key specified by <see cref="M:Context.OperationKey"/>.
/// If the <paramref name="cacheProvider"/> provides a value from cache, returns that value and does not execute the governed delegate. If the <paramref name="cacheProvider"/> does not provide a value, executes the governed delegate, stores the value with the <paramref name="cacheProvider"/>, then returns the value.
/// </para>
/// </summary>
@@ -23,7 +23,7 @@ public static CachePolicy Cache(ISyncCacheProvider cacheProvider, TimeSpan ttl,

/// <summary>
/// <para>Builds a <see cref="Policy" /> that will function like a result cache for delegate executions returning a result.</para>
/// <para>Before executing a delegate returning a result, checks whether the <paramref name="cacheProvider"/> holds a value for the cache key specified by <see cref="M:Context.ExecutionKey"/>.
/// <para>Before executing a delegate returning a result, checks whether the <paramref name="cacheProvider"/> holds a value for the cache key specified by <see cref="M:Context.OperationKey"/>.
/// If the <paramref name="cacheProvider"/> provides a value from cache, returns that value and does not execute the governed delegate. If the <paramref name="cacheProvider"/> does not provide a value, executes the governed delegate, stores the value with the <paramref name="cacheProvider"/>, then returns the value.
/// </para>
/// </summary>
4 changes: 2 additions & 2 deletions src/Polly.Shared/Caching/CacheSyntaxAsync.cs
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ public partial class Policy
{
/// <summary>
/// <para>Builds a <see cref="Policy"/> that will function like a result cache for delegate executions returning a result.</para>
/// <para>Before executing a delegate returning a result, checks whether the <paramref name="cacheProvider"/> holds a value for the cache key specified by <see cref="M:Context.ExecutionKey"/>.
/// <para>Before executing a delegate returning a result, checks whether the <paramref name="cacheProvider"/> holds a value for the cache key specified by <see cref="M:Context.OperationKey"/>.
/// If the <paramref name="cacheProvider"/> provides a value, returns that value and does not execute the governed delegate. If the <paramref name="cacheProvider"/> does not provide a value, executes the governed delegate, stores the value with the <paramref name="cacheProvider"/>, then returns the value.
/// </para>
/// </summary>
@@ -23,7 +23,7 @@ public static CachePolicy CacheAsync(IAsyncCacheProvider cacheProvider, TimeSpan

/// <summary>
/// <para>Builds a <see cref="Policy"/> that will function like a result cache for delegate executions returning a result.</para>
/// <para>Before executing a delegate returning a result, checks whether the <paramref name="cacheProvider"/> holds a value for the cache key specified by <see cref="M:Context.ExecutionKey"/>
/// <para>Before executing a delegate returning a result, checks whether the <paramref name="cacheProvider"/> holds a value for the cache key specified by <see cref="M:Context.OperationKey"/>
/// If the <paramref name="cacheProvider"/> provides a value, returns that value and does not execute the governed delegate. If the <paramref name="cacheProvider"/> does not provide a value, executes the governed delegate, stores the value with the <paramref name="cacheProvider"/>, then returns the value.
/// </para>
/// </summary>
10 changes: 5 additions & 5 deletions src/Polly.Shared/Caching/CacheTResultSyntax.cs
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ public partial class Policy
{
/// <summary>
/// <para>Builds a <see cref="Policy"/> that will function like a result cache for delegate executions returning a <typeparamref name="TResult"/>.</para>
/// <para>Before executing a delegate, checks whether the <paramref name="cacheProvider"/> holds a value for the cache key specified by <see cref="M:Context.ExecutionKey"/>.
/// <para>Before executing a delegate, checks whether the <paramref name="cacheProvider"/> holds a value for the cache key specified by <see cref="M:Context.OperationKey"/>.
/// If the <paramref name="cacheProvider"/> provides a value from cache, returns that value and does not execute the governed delegate. If the <paramref name="cacheProvider"/> does not provide a value, executes the governed delegate, stores the value with the <paramref name="cacheProvider"/>, then returns the value.
/// </para>
/// </summary>
@@ -25,7 +25,7 @@ public static CachePolicy<TResult> Cache<TResult>(ISyncCacheProvider cacheProvid

/// <summary>
/// <para>Builds a <see cref="Policy"/> that will function like a result cache for delegate executions returning a <typeparamref name="TResult"/>.</para>
/// <para>Before executing a delegate, checks whether the <paramref name="cacheProvider"/> holds a value for the cache key specified by <see cref="M:Context.ExecutionKey"/>.
/// <para>Before executing a delegate, checks whether the <paramref name="cacheProvider"/> holds a value for the cache key specified by <see cref="M:Context.OperationKey"/>.
/// If the <paramref name="cacheProvider"/> provides a value from cache, returns that value and does not execute the governed delegate. If the <paramref name="cacheProvider"/> does not provide a value, executes the governed delegate, stores the value with the <paramref name="cacheProvider"/>, then returns the value.
/// </para>
/// </summary>
@@ -345,7 +345,7 @@ public static CachePolicy<TResult> Cache<TResult>(

/// <summary>
/// <para>Builds a <see cref="Policy"/> that will function like a result cache for delegate executions returning a <typeparamref name="TResult"/>.</para>
/// <para>Before executing a delegate, checks whether the <paramref name="cacheProvider"/> holds a value for the cache key specified by <see cref="M:Context.ExecutionKey"/>.
/// <para>Before executing a delegate, checks whether the <paramref name="cacheProvider"/> holds a value for the cache key specified by <see cref="M:Context.OperationKey"/>.
/// If the <paramref name="cacheProvider"/> provides a value from cache, returns that value and does not execute the governed delegate. If the <paramref name="cacheProvider"/> does not provide a value, executes the governed delegate, stores the value with the <paramref name="cacheProvider"/>, then returns the value.
/// </para>
/// </summary>
@@ -361,7 +361,7 @@ public static CachePolicy<TResult> Cache<TResult>(ISyncCacheProvider<TResult> ca

/// <summary>
/// <para>Builds a <see cref="Policy"/> that will function like a result cache for delegate executions returning a <typeparamref name="TResult"/>.</para>
/// <para>Before executing a delegate, checks whether the <paramref name="cacheProvider"/> holds a value for the cache key specified by <see cref="M:Context.ExecutionKey"/>.
/// <para>Before executing a delegate, checks whether the <paramref name="cacheProvider"/> holds a value for the cache key specified by <see cref="M:Context.OperationKey"/>.
/// If the <paramref name="cacheProvider"/> provides a value from cache, returns that value and does not execute the governed delegate. If the <paramref name="cacheProvider"/> does not provide a value, executes the governed delegate, stores the value with the <paramref name="cacheProvider"/>, then returns the value.
/// </para>
/// </summary>
@@ -378,7 +378,7 @@ public static CachePolicy<TResult> Cache<TResult>(ISyncCacheProvider<TResult> ca

/// <summary>
/// <para>Builds a <see cref="Policy"/> that will function like a result cache for delegate executions returning a <typeparamref name="TResult"/>.</para>
/// <para>Before executing a delegate, checks whether the <paramref name="cacheProvider"/> holds a value for the cache key specified by <see cref="M:Context.ExecutionKey"/>.
/// <para>Before executing a delegate, checks whether the <paramref name="cacheProvider"/> holds a value for the cache key specified by <see cref="M:Context.OperationKey"/>.
/// If the <paramref name="cacheProvider"/> provides a value from cache, returns that value and does not execute the governed delegate. If the <paramref name="cacheProvider"/> does not provide a value, executes the governed delegate, stores the value with the <paramref name="cacheProvider"/>, then returns the value.
/// </para>
/// </summary>
10 changes: 5 additions & 5 deletions src/Polly.Shared/Caching/CacheTResultSyntaxAsync.cs
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ public partial class Policy
{
/// <summary>
/// <para>Builds a <see cref="Policy"/> that will function like a result cache for delegate executions returning a <typeparamref name="TResult"/>.</para>
/// <para>Before executing a delegate, checks whether the <paramref name="cacheProvider"/> holds a value for the cache key specified by <see cref="M:Context.ExecutionKey"/>.
/// <para>Before executing a delegate, checks whether the <paramref name="cacheProvider"/> holds a value for the cache key specified by <see cref="M:Context.OperationKey"/>.
/// If the <paramref name="cacheProvider"/> provides a value from cache, returns that value and does not execute the governed delegate. If the <paramref name="cacheProvider"/> does not provide a value, executes the governed delegate, stores the value with the <paramref name="cacheProvider"/>, then returns the value.
/// </para>
/// </summary>
@@ -25,7 +25,7 @@ public static CachePolicy<TResult> CacheAsync<TResult>(IAsyncCacheProvider cache

/// <summary>
/// <para>Builds a <see cref="Policy"/> that will function like a result cache for delegate executions returning a <typeparamref name="TResult"/>.</para>
/// <para>Before executing a delegate, checks whether the <paramref name="cacheProvider"/> holds a value for the cache key specified by <see cref="M:Context.ExecutionKey"/>.
/// <para>Before executing a delegate, checks whether the <paramref name="cacheProvider"/> holds a value for the cache key specified by <see cref="M:Context.OperationKey"/>.
/// If the <paramref name="cacheProvider"/> provides a value from cache, returns that value and does not execute the governed delegate. If the <paramref name="cacheProvider"/> does not provide a value, executes the governed delegate, stores the value with the <paramref name="cacheProvider"/>, then returns the value.
/// </para>
/// </summary>
@@ -345,7 +345,7 @@ public static CachePolicy<TResult> CacheAsync<TResult>(

/// <summary>
/// <para>Builds a <see cref="Policy"/> that will function like a result cache for delegate executions returning a <typeparamref name="TResult"/>.</para>
/// <para>Before executing a delegate, checks whether the <paramref name="cacheProvider"/> holds a value for the cache key specified by <see cref="M:Context.ExecutionKey"/>.
/// <para>Before executing a delegate, checks whether the <paramref name="cacheProvider"/> holds a value for the cache key specified by <see cref="M:Context.OperationKey"/>.
/// If the <paramref name="cacheProvider"/> provides a value from cache, returns that value and does not execute the governed delegate. If the <paramref name="cacheProvider"/> does not provide a value, executes the governed delegate, stores the value with the <paramref name="cacheProvider"/>, then returns the value.
/// </para>
/// </summary>
@@ -361,7 +361,7 @@ public static CachePolicy<TResult> CacheAsync<TResult>(IAsyncCacheProvider<TResu

/// <summary>
/// <para>Builds a <see cref="Policy"/> that will function like a result cache for delegate executions returning a <typeparamref name="TResult"/>.</para>
/// <para>Before executing a delegate, checks whether the <paramref name="cacheProvider"/> holds a value for the cache key specified by <see cref="M:Context.ExecutionKey"/>.
/// <para>Before executing a delegate, checks whether the <paramref name="cacheProvider"/> holds a value for the cache key specified by <see cref="M:Context.OperationKey"/>.
/// If the <paramref name="cacheProvider"/> provides a value from cache, returns that value and does not execute the governed delegate. If the <paramref name="cacheProvider"/> does not provide a value, executes the governed delegate, stores the value with the <paramref name="cacheProvider"/>, then returns the value.
/// </para>
/// </summary>
@@ -378,7 +378,7 @@ public static CachePolicy<TResult> CacheAsync<TResult>(IAsyncCacheProvider<TResu

/// <summary>
/// <para>Builds a <see cref="Policy"/> that will function like a result cache for delegate executions returning a <typeparamref name="TResult"/>.</para>
/// <para>Before executing a delegate, checks whether the <paramref name="cacheProvider"/> holds a value for the cache key specified by <see cref="M:Context.ExecutionKey"/>.
/// <para>Before executing a delegate, checks whether the <paramref name="cacheProvider"/> holds a value for the cache key specified by <see cref="M:Context.OperationKey"/>.
/// If the <paramref name="cacheProvider"/> provides a value from cache, returns that value and does not execute the governed delegate. If the <paramref name="cacheProvider"/> does not provide a value, executes the governed delegate, stores the value with the <paramref name="cacheProvider"/>, then returns the value.
/// </para>
/// </summary>
4 changes: 2 additions & 2 deletions src/Polly.Shared/Caching/DefaultCacheKeyStrategy.cs
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
namespace Polly.Caching
{
/// <summary>
/// The default cache key strategy for <see cref="CachePolicy"/>. Returns the property <see cref="M:Context.ExecutionKey"/>.
/// The default cache key strategy for <see cref="CachePolicy"/>. Returns the property <see cref="M:Context.OperationKey"/>.
/// </summary>
public class DefaultCacheKeyStrategy : ICacheKeyStrategy
{
@@ -14,7 +14,7 @@ public class DefaultCacheKeyStrategy : ICacheKeyStrategy
/// <returns>The cache key</returns>
public String GetCacheKey(Context context)
{
return context.ExecutionKey;
return context.OperationKey;
}

/// <summary>
Loading

0 comments on commit 72f59a1

Please sign in to comment.