Node filter only applies to node list of more than one node
This commit is contained in:
parent
4cdf5d5b8b
commit
e0066c9c0f
2
chain.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() {
|
||||
|
@ -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…
Reference in New Issue
Block a user