mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-04-24 12:12:52 +08:00
22 lines
520 B
C#
22 lines
520 B
C#
using Polly;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
namespace Ocelot.Provider.Polly
|
|
{
|
|
public class CircuitBreaker
|
|
{
|
|
private readonly List<IAsyncPolicy> _policies = new List<IAsyncPolicy>();
|
|
|
|
public CircuitBreaker(params IAsyncPolicy[] policies)
|
|
{
|
|
foreach (var policy in policies.Where(p => p != null))
|
|
{
|
|
this._policies.Add(policy);
|
|
}
|
|
}
|
|
|
|
public IAsyncPolicy[] Policies => this._policies.ToArray();
|
|
}
|
|
}
|