Browse Source

Node filter only applies to node list of more than one node

pull/231/head
rui.zheng 9 years ago
parent
commit
e0066c9c0f
  1. 2
      chain.go
  2. 3
      selector.go

2
chain.go

@ -53,7 +53,7 @@ func (c *Chain) NodeGroups() []*NodeGroup {
}
// LastNode returns the last node of the node list.
// If the chain is empty, an empty node is returns.
// If the chain is empty, an empty node will be returned.
// If the last node is a node group, the first node in the group will be returned.
func (c *Chain) LastNode() Node {
if c.IsEmpty() {

3
selector.go

@ -16,7 +16,6 @@ var (
// NodeSelector as a mechanism to pick nodes and mark their status.
type NodeSelector interface {
Select(nodes []Node, opts ...SelectOption) (Node, error)
// Mark(node Node)
}
type defaultSelector struct {
@ -130,7 +129,7 @@ type FailFilter struct {
// Filter filters nodes.
func (f *FailFilter) Filter(nodes []Node) []Node {
if f.MaxFails <= 0 {
if len(nodes) <= 1 || f.MaxFails <= 0 {
return nodes
}
nl := []Node{}

Loading…
Cancel
Save