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";
13
13
const IS_WIN = require ( "os" ) . platform ( ) === "win32" ;
14
14
const SUPPORTS_RECURSIVE_WATCHING = IS_OSX || IS_WIN ;
15
15
16
+ // Use 20 for OSX to make `FSWatcher.close` faster
17
+ // https://github.com/nodejs/node/issues/29949
16
18
const watcherLimit =
17
- + process . env . WATCHPACK_WATCHER_LIMIT || ( IS_OSX ? 2000 : 10000 ) ;
19
+ + process . env . WATCHPACK_WATCHER_LIMIT || ( IS_OSX ? 20 : 10000 ) ;
18
20
19
21
const recursiveWatcherLogging = ! ! process . env
20
22
. WATCHPACK_RECURSIVE_WATCHER_LOGGING ;
@@ -366,3 +368,4 @@ exports.getNumberOfWatchers = () => {
366
368
} ;
367
369
368
370
exports . createHandleChangeEvent = createHandleChangeEvent ;
371
+ exports . watcherLimit = watcherLimit ;
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ const path = require("path");
6
6
const TestHelper = require ( "./helpers/TestHelper" ) ;
7
7
const Watchpack = require ( "../lib/watchpack" ) ;
8
8
const watchEventSource = require ( "../lib/watchEventSource" ) ;
9
+ const should = require ( "should" ) ;
9
10
10
11
const fixtures = path . join ( __dirname , "fixtures" ) ;
11
12
const testHelper = new TestHelper ( fixtures ) ;
@@ -78,4 +79,11 @@ describe("ManyWatchers", function() {
78
79
} ) ;
79
80
} ) ;
80
81
} ) ;
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
+ } ) ;
81
89
} ) ;
You can’t perform that action at this time.
0 commit comments