Commit e0066c9c authored by rui.zheng's avatar rui.zheng

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

parent 4cdf5d5b
...@@ -53,7 +53,7 @@ func (c *Chain) NodeGroups() []*NodeGroup { ...@@ -53,7 +53,7 @@ func (c *Chain) NodeGroups() []*NodeGroup {
} }
// LastNode returns the last node of the node list. // 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. // If the last node is a node group, the first node in the group will be returned.
func (c *Chain) LastNode() Node { func (c *Chain) LastNode() Node {
if c.IsEmpty() { if c.IsEmpty() {
......
...@@ -16,7 +16,6 @@ var ( ...@@ -16,7 +16,6 @@ var (
// NodeSelector as a mechanism to pick nodes and mark their status. // NodeSelector as a mechanism to pick nodes and mark their status.
type NodeSelector interface { type NodeSelector interface {
Select(nodes []Node, opts ...SelectOption) (Node, error) Select(nodes []Node, opts ...SelectOption) (Node, error)
// Mark(node Node)
} }
type defaultSelector struct { type defaultSelector struct {
...@@ -130,7 +129,7 @@ type FailFilter struct { ...@@ -130,7 +129,7 @@ type FailFilter struct {
// Filter filters nodes. // Filter filters nodes.
func (f *FailFilter) Filter(nodes []Node) []Node { func (f *FailFilter) Filter(nodes []Node) []Node {
if f.MaxFails <= 0 { if len(nodes) <= 1 || f.MaxFails <= 0 {
return nodes return nodes
} }
nl := []Node{} nl := []Node{}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment