Skip to content

Commit

Permalink
fs: set fs.watchFile poll interval to 1s
Browse files Browse the repository at this point in the history
  • Loading branch information
anonrig committed Nov 20, 2022
1 parent 5af2021 commit 17e2914
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 4 additions & 1 deletion doc/api/fs.md
Original file line number Diff line number Diff line change
Expand Up @@ -4448,6 +4448,9 @@ watch('somedir', (eventType, filename) => {
<!-- YAML
added: v0.1.31
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/45536
description: Changed default interval to 1000.
- version: v10.5.0
pr-url: https://github.com/nodejs/node/pull/20220
description: The `bigint` option is now supported.
Expand All @@ -4461,7 +4464,7 @@ changes:
* `options` {Object}
* `bigint` {boolean} **Default:** `false`
* `persistent` {boolean} **Default:** `true`
* `interval` {integer} **Default:** `5007`
* `interval` {integer} **Default:** `1000`
* `listener` {Function}
* `current` {fs.Stats}
* `previous` {fs.Stats}
Expand Down
5 changes: 1 addition & 4 deletions lib/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -2359,10 +2359,7 @@ function watchFile(filename, options, listener) {
}

options = {
// Poll interval in milliseconds. 5007 is what libev used to use. It's
// a little on the slow side but let's stick with it for now to keep
// behavioral changes to a minimum.
interval: 5007,
interval: 1000,
persistent: true,
...options
};
Expand Down

0 comments on commit 17e2914

Please sign in to comment.