Skip to content
This repository has been archived by the owner on Aug 12, 2022. It is now read-only.

fix: Use 'cur' ulimit in calculation, not 'max' #399

Merged
merged 1 commit into from
Jul 3, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions helpers/limit/limits.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ type Rlimit struct {
func GetMaxGoRoutines() uint64 {
limit := calculateGoRoutines(getMemory())
ulimit, err := GetUlimit()
if err != nil || ulimit.Max == 0 {
if err != nil || ulimit.Cur == 0 {
return limit
}
if ulimit.Max > limit {
if ulimit.Cur > limit {
return limit
}
return ulimit.Max
return ulimit.Cur
}

// DiagnoseLimits verifies if user should increase ulimit or max file descriptors to improve number of expected
Expand All @@ -48,11 +48,11 @@ func DiagnoseLimits() (diags diag.Diagnostics) {
diag.WithDetails("available descriptor capacity is %d want %d to run optimally, consider increasing max file descriptors on machine.", fds, want)))
}
ulimit, err := GetUlimit()
if err == nil && ulimit.Max < want {
if err == nil && ulimit.Cur < want {
diags = diags.Add(diag.NewBaseError(errors.New("ulimit available for CloudQuery process lower than expected"),
diag.USER,
diag.WithSeverity(diag.WARNING),
diag.WithDetails("set ulimit capacity is %d want %d to run optimally, consider increasing ulimit on this machine.", ulimit.Max, want)))
diag.WithDetails("set ulimit capacity is %d want %d to run optimally, consider increasing ulimit on this machine.", ulimit.Cur, want)))
}
return diags
}
Expand Down