#262 added working eureka sample (#333)

This commit is contained in:
Tom Pallister
2018-04-26 09:38:36 +01:00
committed by GitHub
parent 027bf6867a
commit 5b63f333f7
18 changed files with 411 additions and 12 deletions

View File

@ -18,6 +18,11 @@ namespace Ocelot.LoadBalancer.LoadBalancers
public async Task<Response<ServiceHostAndPort>> Lease()
{
//todo no point spinning a task up here, also first or default could be null..
if (_services == null || _services.Count == 0)
{
return new ErrorResponse<ServiceHostAndPort>(new ServicesAreEmptyError("There were no services in NoLoadBalancer"));
}
var service = await Task.FromResult(_services.FirstOrDefault());
return new OkResponse<ServiceHostAndPort>(service.HostAndPort);
}