Skip to content

Commit

Permalink
Fix (*consistentHash).Apply
Browse files Browse the repository at this point in the history
Signed-off-by: Roman Zavodskikh <[email protected]>
  • Loading branch information
Roman Zavodskikh committed Mar 14, 2024
1 parent e8697c6 commit 85ca505
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion loadbalancer/algorithm.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,11 @@ func (ch *consistentHash) Apply(ctx *routing.LBContext) routing.LBEndpoint {
return ctx.LBEndpoints[0]
}

// The index returned from this call is taken from hash ring which is built from data about
// all endpoints, including fading in, unhealthy, etc. ones. The index stored in hash ring is
// the index of the endpoint in the original list of endpoints.
choice := ch.chooseConsistentHashEndpoint(ctx)
return ctx.LBEndpoints[choice]
return ctx.Route.LBEndpoints[choice]
}

func (ch *consistentHash) chooseConsistentHashEndpoint(ctx *routing.LBContext) int {
Expand Down

0 comments on commit 85ca505

Please sign in to comment.