Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Watching multiple non-existing files in the same directory results in all files other than the first one being ignored #1276

Open
vilicvane opened this issue Mar 21, 2023 · 1 comment

Comments

@vilicvane
Copy link

vilicvane commented Mar 21, 2023

Versions (please complete the following information):

  • Chokidar version 3.5.3

To Reproduce:

const FS = require("fs");
const Chokidar = require("chokidar");

const watcher = Chokidar.watch(["file-1", "file-2"]);

watcher.on("add", (path) => console.log(path));

// BTW, on("ready") doesn't work either.
setTimeout(() => {
  FS.writeFileSync("file-2", ""); // file-1 would work.
}, 1000);

Expected behavior

All previously non-existing files should receive "add" event on creation.

Additional context

I traced down to the NodeFsHandler#_handleRead() method and the way it throttles is the cause:

_handleRead(directory, initialAdd, wh, target, dir, depth, throttler) {
// Normalize the directory name on Windows
directory = sysPath.join(directory, EMPTY_STR);
if (!wh.hasGlob) {
throttler = this.fsw._throttle('readdir', directory, 1000);
if (!throttler) return;
}

vilicvane added a commit to vilicvane/chokidar that referenced this issue Mar 21, 2023
vilicvane added a commit to vilicvane/chokidar that referenced this issue Mar 22, 2023
vilicvane added a commit to vilicvane/chokidar that referenced this issue Mar 22, 2023
vilicvane added a commit to vilicvane/chokidar that referenced this issue Mar 22, 2023
@ineshbose
Copy link

Has there been a workaround for this yet?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants