Skip to content

Do not send delete event every poll for missing folder #22496

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

Merged
merged 1 commit into from
Mar 13, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/compiler/sys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,10 @@ namespace ts {

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.

// Already deleted file, no need to callback again
return;
}
eventKind = FileWatcherEventKind.Deleted;
}
// previous event kind check is to ensure we send created event when file is restored or renamed twice (that is it disappears and reappears)
Expand Down