1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-31 14:24:25 +03:00

improve file watching

By default, macs have 256 open files allowed by a given process.
This sucks when you end up with over 256 files modified in a repo
because after you've watched all of them, lots of other calls to
the command line will fail due to violating the limit.

Given there's no easy platform agnostic way to see what you've got
configured for how many files a process can have open, I'm going to
arbitrarily set the max to 200 and when we hit the limit we start
unwatching older files to make way for new ones.

WIP
This commit is contained in:
Jesse Duffield
2020-01-08 21:02:01 +11:00
parent 205d731d7b
commit 1ce5c69cd2
3 changed files with 88 additions and 27 deletions

View File

@ -15,7 +15,6 @@ import (
"strings"
"time"
"github.com/fsnotify/fsnotify"
"github.com/go-errors/errors"
// "strings"
@ -82,7 +81,7 @@ type Gui struct {
statusManager *statusManager
credentials credentials
waitForIntro sync.WaitGroup
fileWatcher *fsnotify.Watcher
fileWatcher *fileWatcher
}
// for now the staging panel state, unlike the other panel states, is going to be
@ -840,7 +839,7 @@ func (gui *Gui) RunWithSubprocesses() error {
}
}
gui.fileWatcher.Close()
gui.fileWatcher.Watcher.Close()
break
} else if err == gui.Errors.ErrSwitchRepo {