Use ErrNoneAvailable and test blacklisting

This commit is contained in:
Asim
2016-05-07 00:04:08 +01:00
parent 63c6e82192
commit 75f2706fd0
4 changed files with 84 additions and 6 deletions

View File

@@ -22,7 +22,7 @@ func Random(services []*registry.Service) Next {
return func() (*registry.Node, error) {
if len(nodes) == 0 {
return nil, ErrNotFound
return nil, ErrNoneAvailable
}
i := rand.Int() % len(nodes)
@@ -43,7 +43,7 @@ func RoundRobin(services []*registry.Service) Next {
return func() (*registry.Node, error) {
if len(nodes) == 0 {
return nil, ErrNotFound
return nil, ErrNoneAvailable
}
mtx.Lock()