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

file system event watching fixes #4210

Closed
wants to merge 4 commits into from

Conversation

blakejohnson
Copy link
Contributor

Export watch_file, as this is the easiest API entry point between FileMonitor
and PollingFileMonitor.

Fix _uv_hook_fseventscb such that the Condition is notified even if no callback
is in the FileMonitor. Also fix the value sent to notify to match the expected
return value in wait.

@@ -282,7 +286,7 @@ function poll_file(s, interval_seconds::Real, seconds::Real)
wait(wt) == :poll
end

function watch_file(cb, s; poll=false)
function watch_file(cb=false, s; poll=false)
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

This doesn't work.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, an accidental late addition. Fixing it now.

@Keno
Copy link
Member

Keno commented Sep 4, 2013

We need to come up with a better API than exposing uv internals. Other than that this is a good change.

@blakejohnson
Copy link
Contributor Author

@loladiro I agree that the API needs more work. For starters, we could translate the libuv event types into some kind of FileSystemEvent type. I also wondered about not exporting FileMonitor and PollingFileMonitor, and just having watch_file and poll_fd be the entry points.

@blakejohnson
Copy link
Contributor Author

Looks like the build is failing with my newly added test. I'll look into it (everything passes on my local machine).

@blakejohnson
Copy link
Contributor Author

Ok, tests pass now.

@blakejohnson
Copy link
Contributor Author

I'd prefer to tackle the API issues in a separate pull request. If you'd like me to rebase this before merging, let me know.

blakejohnson and others added 3 commits September 9, 2013 09:06
Export watch_file, as this is the easiest API entry point between FileMonitor
and PollingFileMonitor.

Fix _uv_hook_fseventscb such that the condition is notified even if no callback
is in the monitor. Also fix the value sent to notify() to match the expected
return value in wait().

Fix watch_poll default callback.
@Keno
Copy link
Member

Keno commented Sep 9, 2013

I am uncomfortable adding API that we're gonna break anyway so close to a release.

@JeffBezanson
Copy link
Sponsor Member

Yes the UV_ constants are impermissibly ugly. I would really like to get the bug fix merged though.

@blakejohnson
Copy link
Contributor Author

In this first pass, I was really just trying to fix what was already there. You'll notice that UV_READALBE and UV_WRITABLE were already exported...

That said, I am happy to keep pushing forward with an API refactor in this pull request. Is that what you all would prefer?

@StefanKarpinski
Copy link
Sponsor Member

It seems to me that getting this merged and then fixing the API post haste is probably best. Maybe we should simply not export the new constants?

@blakejohnson
Copy link
Contributor Author

@StefanKarpinski we could do that, and simply patch the test to reach into Base for the constants.

@StefanKarpinski
Copy link
Sponsor Member

I think that's the best course of action – it doesn't break the API any more than it already is and fixes the problem. We can change the API separately.

@JeffBezanson
Copy link
Sponsor Member

UV_READABLE and UV_WRITABLE are equally bad; I filed a whole issue about them.

@blakejohnson
Copy link
Contributor Author

Updated to not export the new constants.

@StefanKarpinski
Copy link
Sponsor Member

Yes, they're certainly just as bad. The idea is that this change does no harm if it doesn't export anything new. We can unexport UV_READABLE and UV_WRITABLE separately.

@blakejohnson
Copy link
Contributor Author

I made some progress tonight on a refactor that gets rid of (exported) UV_ constants. I'll open a PR for it in a day or two.

@JeffBezanson
Copy link
Sponsor Member

I believe this is superseded by #4247.

@StefanKarpinski
Copy link
Sponsor Member

Sorry for making you do pointless work, @blakejohnson!

@blakejohnson blakejohnson deleted the watch-file branch August 23, 2014 03:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants