Skip to content

Commit

Permalink
Workaround: again, set a max limit of 16_384 open files.
Browse files Browse the repository at this point in the history
  • Loading branch information
trikko committed Apr 27, 2024
1 parent d8d138e commit a6c711e
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions source/serverino/main.d
Expand Up @@ -129,19 +129,15 @@ template ServerinoLoop(Modules...)
// NOTE: Waiting for https://github.com/dlang/phobos/pull/8990
version(Posix)
{
version(OSX) { /* This won't work on macOS */}
else
{
import core.sys.posix.sys.resource : rlimit, setrlimit, getrlimit, RLIMIT_NOFILE;
rlimit rlim;
getrlimit(RLIMIT_NOFILE, &rlim);
import core.sys.posix.sys.resource : rlimit, setrlimit, getrlimit, RLIMIT_NOFILE;
rlimit rlim;
getrlimit(RLIMIT_NOFILE, &rlim);

// 16k seems to be a good value that balances performance and resources
// until the issue is fixed
rlim.rlim_cur = max(rlim.rlim_max, 16_384);
// 16k seems to be a good value that balances performance and resources
// until the issue is fixed
rlim.rlim_cur = min(rlim.rlim_max, 16_384);

setrlimit(RLIMIT_NOFILE, &rlim);
}
setrlimit(RLIMIT_NOFILE, &rlim);
}

// Enable terminal colors on older windows
Expand Down

0 comments on commit a6c711e

Please sign in to comment.