mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-04-30 08:42:51 +08:00
29 lines
697 B
C#
29 lines
697 B
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using Ocelot.Responses;
|
|
using Ocelot.Values;
|
|
|
|
namespace Ocelot.LoadBalancer.LoadBalancers
|
|
{
|
|
public class NoLoadBalancer : ILoadBalancer
|
|
{
|
|
private readonly List<Service> _services;
|
|
|
|
public NoLoadBalancer(List<Service> services)
|
|
{
|
|
_services = services;
|
|
}
|
|
|
|
public async Task<Response<HostAndPort>> Lease()
|
|
{
|
|
var service = await Task.FromResult(_services.FirstOrDefault());
|
|
return new OkResponse<HostAndPort>(service.HostAndPort);
|
|
}
|
|
|
|
public void Release(HostAndPort hostAndPort)
|
|
{
|
|
}
|
|
}
|
|
}
|