Skip to content
This repository has been archived by the owner on Nov 20, 2018. It is now read-only.

Add a polling watcher #66

Merged
merged 1 commit into from
Apr 13, 2016
Merged

Add a polling watcher #66

merged 1 commit into from
Apr 13, 2016

Conversation

victorhurdugaci
Copy link
Contributor

Fixes #55

cc @moozzyk


namespace Microsoft.DotNet.Watcher.Core.Internal
{
internal class DotnetFileWatcher : IFileSystemWatcher
Copy link

Choose a reason for hiding this comment

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

Already in the Internal namespace. Could this be public instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No every type in the internal namespace has to be public

{
public static IFileSystemWatcher CreateWatcher(string watchedDirectory)
{
var envVar = Environment.GetEnvironmentVariable("USE_POLLING_FILE_WATCHER");
Copy link
Member

Choose a reason for hiding this comment

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

Are we using the same var for the cshtml PR that @pranavkm is doing? If so then POLLING_FILE_WATCHER probably isn't accurate. More like USE_NETWORK_SHARE_FALLBACK or USE_NETWORK_SHARE_WATCHER or something. If they are different keys then this is fine :)

Copy link
Contributor

Choose a reason for hiding this comment

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

I was using ASPNETCORE_POLL_FOR_FILE_CHANGES. Open to suggestions for alternatives

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It has nothing to do with network share. It's just enables a polling file watcher which can be used for non-network shares. Also, it's not an ASPNETCORE feature (at least in dotnet-watch)

Copy link
Member

Choose a reason for hiding this comment

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

I know that, I was throwing out suggestions based on the scenario where it makes sense to use this vs anything else. I am not super worried about them being different, lets talk about it in-person tomorrow.

@victorhurdugaci
Copy link
Contributor Author

Tested with an app that has 21K watched files. The changes were instant and you couldn't tell without a profiler the difference in time between the polling watcher and the dotnet one. Also, tested on docker and it works with mounted volumes

@victorhurdugaci
Copy link
Contributor Author

@davidfowl watched the 21K files tests and approved it :)

@victorhurdugaci
Copy link
Contributor Author

Updated the test file watcher to use polling

@chribben
Copy link

Is this feature available in a NuGet package or Docker image somewhere?

@victorhurdugaci
Copy link
Contributor Author

Yes, it is.

Add the Microsoft.DotNet.Watcher.Tools tool in project.json:

"tools": {
  "Microsoft.DotNet.Watcher.Tools": {
    "version": "1.0.0-*",
    "imports": "portable-net451+win8"
  }
}

Then, to enable the polling watcher, set the environment variable USE_POLLING_FILE_WATCHER=1 before running dotnet watch

@chribben
Copy link

Nice, will try it out!

On Fri, Apr 22, 2016 at 5:08 PM, Victor Hurdugaci notifications@github.com
wrote:

Yes, it is.

Add the Microsoft.DotNet.Watcher.Tools tool in project.json:

"tools": {
"Microsoft.DotNet.Watcher.Tools": {
"version": "1.0.0-*",
"imports": "portable-net451+win8"
}
}

Then, to enable the polling watcher, set the environment variable
USE_POLLING_FILE_WATCHER=1 before running dotnet watch


You are receiving this because you commented.
Reply to this email directly or view it on GitHub
#66 (comment)

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.

6 participants