Skip to content

Conversation

@sheetalkamat
Copy link
Member

Fixes #22494

@sheetalkamat sheetalkamat merged commit 32018f6 into master Mar 13, 2018
@sheetalkamat sheetalkamat deleted the suppressMultipleDelete branch March 13, 2018 18:11

function fileChanged(curr: any, prev: any) {
if (+curr.mtime === 0) {
if (eventKind === FileWatcherEventKind.Deleted) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have some concerns with this approach. First, I think it might be cleaner (since it would be stateless) to pull up the mtime check from below. Both curr and prev have timestamp 0, so it would succeed and suppress the callback.

Second, I'm concerned that this only addresses the symptoms of the problem. Why are we getting a fileChanged notification that has never existed and continues not to exist? My limited debugging suggests that this used to be suppressed when oldStatus === -1 and newStatus === -1 (somewhere in sys or fs) but that we are now seeing newStatus === -4058. If this is a Node limitation, then I think we need a big comment here explaining that we're working around a library limitation.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My breakpoint was at line 1448 of fs.js, but I can't get it to load the text without debugging the issue again, which I'm not currently set up to do.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sheetalkamat
Copy link
Member Author

sheetalkamat commented Mar 13, 2018

You are getting this fileChanged callback because we watch missing folders using polling file watch since fs.watch would throw exception on watching missing folders. Earlier before PR #21243 we use to send it based on prev time also being 0 but given that we now have the state of events (eg. to send the create event correctly read the note when deciding to send create event) this seems simpler.

@amcasey
Copy link
Member

amcasey commented Mar 13, 2018

With this approach, is there going to be an initial Deleted event? If so, why?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants