unblack list when err is nil

This commit is contained in:
Asim 2015-12-09 02:42:02 +00:00
parent f59787a906
commit 46905347bb

View File

@ -107,6 +107,11 @@ func (r *blackListSelector) Select(service string, opts ...SelectOption) (Select
func (r *blackListSelector) Mark(service string, node *Node, err error) { func (r *blackListSelector) Mark(service string, node *Node, err error) {
r.Lock() r.Lock()
defer r.Unlock() defer r.Unlock()
if err == nil {
delete(r.bl, node.Id)
return
}
r.bl[node.Id] = blackListNode{ r.bl[node.Id] = blackListNode{
age: time.Now().Add(time.Duration(r.ttl) * time.Second), age: time.Now().Add(time.Duration(r.ttl) * time.Second),
id: node.Id, id: node.Id,