Add flag for connection rate limit and slow zero-progress operations
This commit is contained in:
@@ -24,6 +24,7 @@ var (
|
||||
inKubeCluster = flag.Bool("in-kube-cluster", false, "Use in-cluster kubernetes config")
|
||||
cpuProfile = flag.String("cpu-profile", "", "Enables CPU profiling and writes to given path")
|
||||
debug = flag.Bool("debug", false, "Enable debug logs")
|
||||
connRateLimit = flag.Int("connection-rate-limit", 1, "Max number of connections to allow per second")
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -71,7 +72,10 @@ func main() {
|
||||
|
||||
server.Routes.RegisterAll(parseMappings(*mappings))
|
||||
|
||||
server.Connector.StartAcceptingConnections(ctx, net.JoinHostPort("", strconv.Itoa(*port)))
|
||||
if *connRateLimit < 1 {
|
||||
*connRateLimit = 1
|
||||
}
|
||||
server.Connector.StartAcceptingConnections(ctx, net.JoinHostPort("", strconv.Itoa(*port)), *connRateLimit)
|
||||
|
||||
if *apiBinding != "" {
|
||||
server.StartApiServer(*apiBinding)
|
||||
|
||||
Reference in New Issue
Block a user