Commit 2b18babb authored by felipe andrade's avatar felipe andrade Committed by GitHub

feat(proxyd): make max batch size hard limit 1000 and default 100 (#7719)

            * feat: make max batch size hard limit 1000 and default 100

* nit: rename const
  
  
parent 58769ba1
...@@ -31,18 +31,19 @@ import ( ...@@ -31,18 +31,19 @@ import (
) )
const ( const (
ContextKeyAuth = "authorization" ContextKeyAuth = "authorization"
ContextKeyReqID = "req_id" ContextKeyReqID = "req_id"
ContextKeyXForwardedFor = "x_forwarded_for" ContextKeyXForwardedFor = "x_forwarded_for"
MaxBatchRPCCallsHardLimit = 100 DefaultMaxBatchRPCCallsLimit = 100
cacheStatusHdr = "X-Proxyd-Cache-Status" MaxBatchRPCCallsHardLimit = 1000
defaultRPCTimeout = 10 * time.Second cacheStatusHdr = "X-Proxyd-Cache-Status"
defaultBodySizeLimit = 256 * opt.KiB defaultRPCTimeout = 10 * time.Second
defaultWSHandshakeTimeout = 10 * time.Second defaultBodySizeLimit = 256 * opt.KiB
defaultWSReadTimeout = 2 * time.Minute defaultWSHandshakeTimeout = 10 * time.Second
defaultWSWriteTimeout = 10 * time.Second defaultWSReadTimeout = 2 * time.Minute
maxRequestBodyLogLen = 2000 defaultWSWriteTimeout = 10 * time.Second
defaultMaxUpstreamBatchSize = 10 maxRequestBodyLogLen = 2000
defaultMaxUpstreamBatchSize = 10
) )
var emptyArrayResponse = json.RawMessage("[]") var emptyArrayResponse = json.RawMessage("[]")
...@@ -108,7 +109,11 @@ func NewServer( ...@@ -108,7 +109,11 @@ func NewServer(
maxUpstreamBatchSize = defaultMaxUpstreamBatchSize maxUpstreamBatchSize = defaultMaxUpstreamBatchSize
} }
if maxBatchSize == 0 || maxBatchSize > MaxBatchRPCCallsHardLimit { if maxBatchSize == 0 {
maxBatchSize = DefaultMaxBatchRPCCallsLimit
}
if maxBatchSize > MaxBatchRPCCallsHardLimit {
maxBatchSize = MaxBatchRPCCallsHardLimit maxBatchSize = MaxBatchRPCCallsHardLimit
} }
......
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