Prefer watchFile over watch #18

merged 1 commit into from Jul 5, 2012


None yet
4 participants

A commit log should not only explain what it changes but also why... why is watchFile > watch?

(EDIT: I wager it's because doesn't work with NFS mounts but that's speculation on my side.)


mattpardee commented Jul 4, 2012

@bnoordhuis The issue was the frequency at which watch events were dispatched, and the vagueness of the events dispatched. This forced the callee to do a stat on the file anyway and find out what changed.

It also may have been the cause for some very, very odd behavior. We would be watching a file "/path/to/" and after the first time the contents of the file were modified and an event was dispatched (oddly enough with the event type "rename") it would subsequently emit "rename" events on the parent directory every time there was a change and at seemingly random intervals.

We were baffled by this mystery but I had used watchFile with success before. It worked here without any of the aforementioned issues.

I realize the consistency of watchFile is greater because it stats on a regular interval but the consequences of using this technique are low. Even on this is not an issue because each workspace is in its own container.


creationix commented Jul 5, 2012

I'm fine with this change. Who else is using this API? Isn't @cadorn using it for something?


gjtorikian commented Jul 5, 2012

@creationix Yes:

That's where this whole issue started from. File watching appeared broken on Cloud9 Local, but was actually broken on Cloud9 OSS. The change here works for both repos.

creationix merged commit 2be2154 into master Jul 5, 2012


creationix commented Jul 5, 2012

Published to npm as vfs-local@0.1.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment