Minor refactoring and deleted a ResilientPolicy class not being used.

This commit is contained in:
Cesar De la Torre 2017-05-06 15:37:31 -07:00
parent 9cc6adbd89
commit 5156ec81f7
2 changed files with 7 additions and 18 deletions

View File

@ -1,10 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Microsoft.eShopOnContainers.BuildingBlocks.Resilience.Http
{
public class ResiliencePolicy
{
}
}

View File

@ -31,6 +31,13 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.Resilience.Http
_policyWrapper = Policy.WrapAsync(policies); _policyWrapper = Policy.WrapAsync(policies);
} }
private Task<T> HttpInvoker<T>(Func<Task<T>> action)
{
// Executes the action applying all
// the policies defined in the wrapper
return _policyWrapper.ExecuteAsync(() => action());
}
public Task<string> GetStringAsync(string uri, string authorizationToken = null, string authorizationMethod = "Bearer") public Task<string> GetStringAsync(string uri, string authorizationToken = null, string authorizationMethod = "Bearer")
{ {
return HttpInvoker(async () => return HttpInvoker(async () =>
@ -103,13 +110,5 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.Resilience.Http
}); });
} }
private Task<T> HttpInvoker<T>(Func<Task<T>> action)
{
// Executes the action applying all
// the policies defined in the wrapper
return _policyWrapper.ExecuteAsync(() => action());
}
} }
} }