Skip to content

Commit

Permalink
watch: decrease debounce rate
Browse files Browse the repository at this point in the history
PR-URL: #48926
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
  • Loading branch information
MoLow authored and targos committed Oct 28, 2023
1 parent 83a6d20 commit f27d505
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/internal/main/watch_mode.js
Expand Up @@ -42,7 +42,7 @@ const args = ArrayPrototypeFilter(process.execArgv, (arg, i, arr) =>
arg !== '--watch' && arg !== '--watch-preserve-output');
ArrayPrototypePushApply(args, kCommand);

const watcher = new FilesWatcher({ debounce: 500, mode: kShouldFilterModules ? 'filter' : 'all' });
const watcher = new FilesWatcher({ debounce: 200, mode: kShouldFilterModules ? 'filter' : 'all' });
ArrayPrototypeForEach(kWatchedPaths, (p) => watcher.watchPath(p));

let graceTimer;
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/test_runner/runner.js
Expand Up @@ -419,7 +419,7 @@ function runTestFile(path, root, inspectPort, filesWatcher, testNamePatterns) {
function watchFiles(testFiles, root, inspectPort, signal, testNamePatterns) {
const runningProcesses = new SafeMap();
const runningSubtests = new SafeMap();
const watcher = new FilesWatcher({ debounce: 500, mode: 'filter', signal });
const watcher = new FilesWatcher({ debounce: 200, mode: 'filter', signal });
const filesWatcher = { __proto__: null, watcher, runningProcesses, runningSubtests };

watcher.on('changed', ({ owners }) => {
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/watch_mode/files_watcher.js
Expand Up @@ -31,7 +31,7 @@ class FilesWatcher extends EventEmitter {
#mode;
#signal;

constructor({ debounce = 500, mode = 'filter', signal } = kEmptyObject) {
constructor({ debounce = 200, mode = 'filter', signal } = kEmptyObject) {
super();

validateNumber(debounce, 'options.debounce', 0, TIMEOUT_MAX);
Expand Down

0 comments on commit f27d505

Please sign in to comment.