Minor refactoring and deleted a ResilientPolicy class not being used.
This commit is contained in:
parent
9cc6adbd89
commit
5156ec81f7
@ -1,10 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.BuildingBlocks.Resilience.Http
|
|
||||||
{
|
|
||||||
public class ResiliencePolicy
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
@ -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());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user