lib/osutil: Fix raising max FDs on macOS (#7507)

There was a logic mistake, so the limit in question wasn't used. On my
macOS this doesn't seem to matter, the hard limit returned is 2^63-1 and
setting the soft limit to that works. However I'm assuming that's not
the case for older macOSes since it was so nicely documented, so we
should still have this working. (10240 FDs should be enough for
anybody.)
This commit is contained in:
Jakob Borg 2021-03-20 16:32:36 +01:00 committed by GitHub
parent 4b02b7e6f1
commit ebcd22b02b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -36,7 +36,7 @@ func MaximizeOpenFileLimit() (int, error) {
// macOS doesn't like a soft limit greater then OPEN_MAX // macOS doesn't like a soft limit greater then OPEN_MAX
// See also: man setrlimit // See also: man setrlimit
if runtime.GOOS == "darwin" && lim.Max > darwinOpenMax { if runtime.GOOS == "darwin" && lim.Max > darwinOpenMax {
lim.Cur = darwinOpenMax lim.Max = darwinOpenMax
} }
// Try to increase the limit to the max. // Try to increase the limit to the max.