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
This commit is contained in:
felipe andrade 2023-10-17 13:19:13 -07:00 committed by GitHub
parent 9e1c96e9c5
commit 4e0100bbe9

@ -34,7 +34,8 @@ const (
ContextKeyAuth = "authorization" ContextKeyAuth = "authorization"
ContextKeyReqID = "req_id" ContextKeyReqID = "req_id"
ContextKeyXForwardedFor = "x_forwarded_for" ContextKeyXForwardedFor = "x_forwarded_for"
MaxBatchRPCCallsHardLimit = 100 DefaultMaxBatchRPCCallsLimit = 100
MaxBatchRPCCallsHardLimit = 1000
cacheStatusHdr = "X-Proxyd-Cache-Status" cacheStatusHdr = "X-Proxyd-Cache-Status"
defaultRPCTimeout = 10 * time.Second defaultRPCTimeout = 10 * time.Second
defaultBodySizeLimit = 256 * opt.KiB defaultBodySizeLimit = 256 * opt.KiB
@ -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
} }