Merge pull request #3666 from Shopify/change-legacy-func-name
rename sysctlFSFileMax to rlimitMaxNumFiles to reflect what it actually does
This commit is contained in:
commit
d968ee9cfd
3 changed files with 5 additions and 6 deletions
|
@ -527,7 +527,7 @@ func (n *NGINXController) OnUpdate(ingressCfg ingress.Configuration) error {
|
|||
if err != nil {
|
||||
wp = 1
|
||||
}
|
||||
maxOpenFiles := (sysctlFSFileMax() / wp) - 1024
|
||||
maxOpenFiles := (rlimitMaxNumFiles() / wp) - 1024
|
||||
klog.V(3).Infof("Maximum number of open file descriptors: %d", maxOpenFiles)
|
||||
if maxOpenFiles < 1024 {
|
||||
// this means the value of RLIMIT_NOFILE is too low.
|
||||
|
|
|
@ -64,9 +64,8 @@ func sysctlSomaxconn() int {
|
|||
return maxConns
|
||||
}
|
||||
|
||||
// sysctlFSFileMax returns the maximum number of open file descriptors (value
|
||||
// of fs.file-max) or 0 in case of error.
|
||||
func sysctlFSFileMax() int {
|
||||
// rlimitMaxNumFiles returns hard limit for RLIMIT_NOFILE
|
||||
func rlimitMaxNumFiles() int {
|
||||
var rLimit syscall.Rlimit
|
||||
err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &rLimit)
|
||||
if err != nil {
|
||||
|
|
|
@ -20,8 +20,8 @@ import (
|
|||
"testing"
|
||||
)
|
||||
|
||||
func TestSysctlFSFileMax(t *testing.T) {
|
||||
i := sysctlFSFileMax()
|
||||
func TestRlimitMaxNumFiles(t *testing.T) {
|
||||
i := rlimitMaxNumFiles()
|
||||
if i < 1 {
|
||||
t.Errorf("returned %v but expected > 0", i)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue