Skip to content

Commit

Permalink
BUG/MINOR: runtime: use correct check when calculating max byte size
Browse files Browse the repository at this point in the history
  • Loading branch information
oktalz committed Mar 29, 2024
1 parent c89e884 commit b9438f0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/haproxy/api/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func (c *clientNative) SetServerAddrAndState(servers []RuntimeServerData) error
return nil
}
backendNameSize := len(servers[0].BackendName)
oneServerCommandSize := 65 + 2*backendNameSize
oneServerCommandSize := 75 + 2*backendNameSize
size := oneServerCommandSize * len(servers)
if size > BufferSize {
size = BufferSize
Expand Down Expand Up @@ -73,7 +73,7 @@ func (c *clientNative) SetServerAddrAndState(servers []RuntimeServerData) error
cmdBuilder.WriteString(";")
// if new commands are added recalculate oneServerCommandSize

if sb.Len()+cmdBuilder.Len() >= size {
if sb.Len()+cmdBuilder.Len() >= BufferSize {
err = c.runRaw(runtime, sb, server.BackendName)
if err != nil {
return err
Expand Down

0 comments on commit b9438f0

Please # to comment.