mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-08-10 13:20:33 +02:00
all: add configuration to limit max concurrent requests
Currently, there's no upper bound for how many requests that ctrld will handle at a time. This could be problem on some low capacity routers, where CPU/RAM is very limited. This commit adds a configuration to limit how many requests that will be handled concurrently. The default is 256, which should works well for most routers (the default concurrent requests of dnsmasq is 150).
This commit is contained in:
@@ -75,6 +75,7 @@ func TestConfigValidation(t *testing.T) {
|
||||
{"os upstream", configWithOsUpstream(t), false},
|
||||
{"invalid rules", configWithInvalidRules(t), true},
|
||||
{"invalid dns rcodes", configWithInvalidRcodes(t), true},
|
||||
{"invalid max concurrent requests", configWithInvalidMaxConcurrentRequests(t), true},
|
||||
}
|
||||
|
||||
for _, tc := range tests {
|
||||
@@ -176,3 +177,10 @@ func configWithInvalidRcodes(t *testing.T) *ctrld.Config {
|
||||
}
|
||||
return cfg
|
||||
}
|
||||
|
||||
func configWithInvalidMaxConcurrentRequests(t *testing.T) *ctrld.Config {
|
||||
cfg := defaultConfig(t)
|
||||
n := -1
|
||||
cfg.Service.MaxConcurrentRequests = &n
|
||||
return cfg
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user