joh/when-changed

On OS X 10.10.5, misses multiple simultaneous file changes

dtgriscom opened this issue · 7 comments

I'm watching a directory of files under OS X 10.10.5, with the latest when-changed and watchdog version 0.8.3. Changing individual files works just fine, but when changing more than one file at a time, only one of the file changes is reported.

I'm happy to give additional details or do tests as requested.

Edit: further info; the changes can be separated by a second or two, and still only the first one is recognized. It looks like all subsequent changes are ignored from when a file is changed until when-changed has finished executing the resulting change command (which in my case takes a few seconds).

joh commented

Hmm, I wonder if this was introduced by ea2cf37? Could you try 1b87462?

I'm not a pip maven, so I'm not sure I got it right (and can't figure out how to determine the installed version), but I installed with the following:

pip install git+git://github.com/joh/when-changed.git@1b87462

and then tried again, this time using a simple test command that just printed the changed file. Nope: changed four files simultaneously, only one was reported. This time, however, when-changed properly reported multiple changed files when they were changed one second apart; I presume this is because the test command ran quickly. As a further test, I added a "sleep 5" to the command, and then changed four files at three second intervals; only the first and third were reported.

Just following the maths here, I think when-changed is only checking for changes while the supplied commands are not running. Can you try running your tests again with and & at the end so that it doesn't wait to rejoin?

I would do it but I haven't experienced this behaviour and so can't really correct it (or if you like you could supply the relevant part of code you are testing with and then we can all be testing the same thing).

Cheers

@Cypher1 : I tried adding a & to the end of the command run by when-changed, but it made no difference.

I've created a set of reproduction tools, complete with a ReadMe.md. They're attached here.
issue49test.zip

joh commented

Indeed, looks like a bug introduced by ea2cf37.

Sorry I wasn't able to confirm that before; I must have botched the pip command.