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

fs: check initialized flag and exit if false in FSWatcher onchange #26848

Closed
wants to merge 1 commit into from
Closed

fs: check initialized flag and exit if false in FSWatcher onchange #26848

wants to merge 1 commit into from

Conversation

BeniCheni
Copy link
Contributor

After checking out the TODO comment in lib/internal/fs/watchers.js, this PR follows the suggestion to check initialized flag, and exits when "falsy", in favor to avoid firing events after the handle is closed.

// TODO(joyeecheung): we may check self._handle.initialized here
// and return if that is false. This allows us to avoid firing the event
// after the handle is closed, and to fire both UV_RENAME and UV_CHANGE
// if they are set by libuv at the same time.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

@nodejs-github-bot nodejs-github-bot added the fs Issues and PRs related to the fs subsystem / file system. label Mar 22, 2019
@ZYSzys ZYSzys requested a review from joyeecheung March 22, 2019 04:29
Copy link
Member

@joyeecheung joyeecheung left a comment

Choose a reason for hiding this comment

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

I don't really remember the context about this TODO anymore..could you add a test?

@addaleax

This comment has been minimized.

@BridgeAR
Copy link
Member

BridgeAR commented Apr 3, 2019

Ping @BeniCheni

@BeniCheni
Copy link
Contributor Author

BeniCheni commented Apr 3, 2019

@BridgeAR, sorry about the delay & thanks for pinging. Been learning how to write a test with the fs initialized flag. Haven’t figured out yet.

Any existing test that I could shadow? (Could use some mentoring. If no example, and I couldn’t figure, I will close this trivial PR to avoid any confusion. Thanks)

@BeniCheni
Copy link
Contributor Author

Closing this PR for now, until when I figure out how to test with the initialized flag. Thanks for the previous review.

@BeniCheni BeniCheni closed this Apr 4, 2019
@BeniCheni BeniCheni deleted the fs-watcher-onchange-initialized-check branch April 4, 2019 02:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fs Issues and PRs related to the fs subsystem / file system.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants