diff --git a/internal/lsp/watcher/global_watcher.go b/internal/lsp/watcher/global_watcher.go index 7045cb04837b2fc33b0696c089f12adc220db587..5a546a7db45ffa006a97d9ba98d8816665a6efa1 100644 --- a/internal/lsp/watcher/global_watcher.go +++ b/internal/lsp/watcher/global_watcher.go @@ -118,7 +118,7 @@ func Start() error { // Check if the error might be due to file descriptor limits if isFileLimitError(err) { slog.Warn("lsp watcher: Hit file descriptor limit, attempting to increase", "error", err) - if newLimit, rlimitErr := MaximizeOpenFileLimit(); rlimitErr == nil { + if newLimit, rlimitErr := maximizeOpenFileLimit(); rlimitErr == nil { slog.Info("lsp watcher: Increased file descriptor limit", "limit", newLimit) // Retry the watch operation if err = notify.Watch(watchPath, gw.events, events); err == nil { diff --git a/internal/lsp/watcher/rlimit_stub.go b/internal/lsp/watcher/rlimit_stub.go index e60cf27d80bae21fe326f2b584dd32aac03130d4..9e39467f21bf602c73fd124f799139e4b6cafc09 100644 --- a/internal/lsp/watcher/rlimit_stub.go +++ b/internal/lsp/watcher/rlimit_stub.go @@ -2,11 +2,11 @@ package watcher -// MaximizeOpenFileLimit is a no-op on non-Unix systems. +// maximizeOpenFileLimit is a no-op on non-Unix systems. // Returns a high value to indicate no practical limit. -func MaximizeOpenFileLimit() (int, error) { +func maximizeOpenFileLimit() (int, error) { // Windows and other non-Unix systems don't have file descriptor limits // in the same way Unix systems do. Return a very high value to indicate // there's no practical limit to worry about. return 10000000, nil // 10M handles - way more than any process would use -} \ No newline at end of file +} diff --git a/internal/lsp/watcher/rlimit_unix.go b/internal/lsp/watcher/rlimit_unix.go index 29f99c4fdba2870ea5e8f8e68273e99c4e98e3de..298f3d5b3004a032f0ce5cc592ed30e954fef3f9 100644 --- a/internal/lsp/watcher/rlimit_unix.go +++ b/internal/lsp/watcher/rlimit_unix.go @@ -16,11 +16,11 @@ const ( darwinOpenMax = 10240 ) -// MaximizeOpenFileLimit tries to set the resource limit RLIMIT_NOFILE (number +// maximizeOpenFileLimit tries to set the resource limit RLIMIT_NOFILE (number // of open file descriptors) to the max (hard limit), if the current (soft // limit) is below the max. Returns the new (though possibly unchanged) limit, // or an error if it could not be changed. -func MaximizeOpenFileLimit() (int, error) { +func maximizeOpenFileLimit() (int, error) { // Get the current limit on number of open files. var lim syscall.Rlimit if err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &lim); err != nil {