Only scale ulimit if soft limit < hard limit
@@ -43,6 +43,7 @@ func ConfigureLimitsUnix() {
scaleWorkersToLimit(int(limit.Max), margin)
}
+ if originalLimit < limit.Max {
err = syscall.Setrlimit(syscall.RLIMIT_NOFILE, &limit)
if err != nil {
printWarnf("Adjusting file limit failed: %v", err)
@@ -52,6 +53,7 @@ func ConfigureLimitsUnix() {
}
}
}
+}
func scaleWorkersToLimit(max, margin int) {
scalingBase := (max - margin) / 5
