Skip to content

Commit 779bc94

Browse files
committed
fix good states for balancer
1 parent 0382378 commit 779bc94

File tree

1 file changed

+6
-6
lines changed
  • internal/balancer/rr

1 file changed

+6
-6
lines changed

internal/balancer/rr/rr.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,12 @@ func (r *randomChoice) Next() conn.Conn {
141141
}
142142

143143
func isOkConnection(c conn.Conn, bannedIsOk bool) bool {
144-
state := c.GetState()
145-
if state == conn.Online || state == conn.Created {
146-
return true
147-
}
148-
if bannedIsOk && state == conn.Banned {
144+
switch c.GetState() {
145+
case conn.Online, conn.Created, conn.Offline:
149146
return true
147+
case conn.Banned:
148+
return bannedIsOk
149+
default:
150+
return false
150151
}
151-
return false
152152
}

0 commit comments

Comments
 (0)