File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -13,8 +13,10 @@ const IS_OSX = require("os").platform() === "darwin";
1313const IS_WIN = require ( "os" ) . platform ( ) === "win32" ;
1414const SUPPORTS_RECURSIVE_WATCHING = IS_OSX || IS_WIN ;
1515
16+ // Use 20 for OSX to make `FSWatcher.close` faster
17+ // https://github.com/nodejs/node/issues/29949
1618const watcherLimit =
17- + process . env . WATCHPACK_WATCHER_LIMIT || ( IS_OSX ? 2000 : 10000 ) ;
19+ + process . env . WATCHPACK_WATCHER_LIMIT || ( IS_OSX ? 20 : 10000 ) ;
1820
1921const recursiveWatcherLogging = ! ! process . env
2022 . WATCHPACK_RECURSIVE_WATCHER_LOGGING ;
@@ -366,3 +368,4 @@ exports.getNumberOfWatchers = () => {
366368} ;
367369
368370exports . createHandleChangeEvent = createHandleChangeEvent ;
371+ exports . watcherLimit = watcherLimit ;
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ const path = require("path");
66const TestHelper = require ( "./helpers/TestHelper" ) ;
77const Watchpack = require ( "../lib/watchpack" ) ;
88const watchEventSource = require ( "../lib/watchEventSource" ) ;
9+ const should = require ( "should" ) ;
910
1011const fixtures = path . join ( __dirname , "fixtures" ) ;
1112const testHelper = new TestHelper ( fixtures ) ;
@@ -78,4 +79,11 @@ describe("ManyWatchers", function() {
7879 } ) ;
7980 } ) ;
8081 } ) ;
82+
83+ it ( "should set the watcher limit based on the platform" , ( ) => {
84+ should . equal (
85+ watchEventSource . watcherLimit ,
86+ require ( "os" ) . platform ( ) === "darwin" ? 20 : 10000
87+ ) ;
88+ } ) ;
8189} ) ;
You can’t perform that action at this time.
0 commit comments