mirror of
https://github.com/usebruno/bruno.git
synced 2024-12-23 07:09:01 +01:00
Fix/enospc (#2789)
* fix: Handle ENOSPC error from chokidar Now listens to the error event to check if "ENOSPC" occurrs. The watcher will then automaticly restart in polling mode, so that the user still sees his reqeusts / collections. Fixes: https://github.com/usebruno/bruno/issues/1877 * Add more code comments, add !forcePolling to prevent endless loops and update error message * fix: Also listen for EMFILE for too many watched files
This commit is contained in:
parent
9d84906f57
commit
8de6b72ab9
@ -464,9 +464,10 @@ class Watcher {
|
||||
.on('unlink', (pathname) => unlink(win, pathname, collectionUid, watchPath))
|
||||
.on('unlinkDir', (pathname) => unlinkDir(win, pathname, collectionUid, watchPath))
|
||||
.on('error', (error) => {
|
||||
// `EMFILE` is an error code thrown when to many files are watched at the same time see: https://github.com/usebruno/bruno/issues/627
|
||||
// `ENOSPC` stands for "Error No space" but is also thrown if the file watcher limit is reached.
|
||||
// To prevent loops `!forcePolling` is checked.
|
||||
if (error.code === 'ENOSPC' && !startedNewWatcher && !forcePolling) {
|
||||
if ((error.code === 'ENOSPC' || error.code === 'EMFILE') && !startedNewWatcher && !forcePolling) {
|
||||
// This callback is called for every file the watcher is trying to watch. To prevent a spam of messages and
|
||||
// Multiple watcher being started `startedNewWatcher` is set to prevent this.
|
||||
startedNewWatcher = true;
|
||||
|
Loading…
Reference in New Issue
Block a user