-
Notifications
You must be signed in to change notification settings - Fork 168
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
Watching more than expected. #227
Comments
Did this ever get solved? |
Sorry I haven't. |
@rquadling @SkydiverFL This issue sticks very deep, but is located to this function here: https://github.com/shama/gaze/blob/master/lib/gaze.js#L272 And this line of code fucking the whole thing: https://github.com/shama/gaze/blob/master/lib/gaze.js#L286 If you do a console.log on 287 console.log(this._watched) You will see the files mentioned in this issue, If you do it on the line above, everything is just fine. So this line of code trigger this helper.objectPush(this._watched, path.dirname(filepath) + path.sep, filepath);
// console log this too: path.dirname(filepath) + path.sep Issue here is that the repo owner doesn't seem to fix this. @shama Wont to fix this? |
This is not really a bug IMO. It watches certain folders that could potentially have matching files added to it. It just doesn't hide those files when reporting what files it is watching. Also just because it says it's watching the |
@shama In my case it was saying it was watching node_modules, and 23k files inside that folder. I know so because 23k was added when I started the watcher. And this is similar to what @rquadling was observing. This is not happening when you add files the first time, only if you change the content of one file. Then I got 23k files extra to watch. |
What is odd is that I can watch specific files in a subdirectory and only those files are watched. Watch files in the local root and ALL files in the local root are watched. |
@rquadling @shama I investigated a little more on this, and I found something interesting. In my root folder. Say I just have a test.js file that I want to watch. I adding it like this:
When I check what file(s) it's watching. In this case this files added to the watcher are:
Note I only requested to watch test.js file. Just to check if it's only watching one single file. I changed the content in a file inside on of the sub folders, and I'm now seeing this message in the console:
Another strange things is there is no differene between star () and the globstar (*). A globstar adds sub dirs and files as well. Example
In your module both * and * are equalent. See Glob wildcards regarding this and how it should work. I also couldn't find any options for
so maybe it adds hidden and dot files as well? And this took me to another issue, out of topics of this issue ticket. E.g. in native I didn't test this too much, but just scratched the surface of issues I found just now. Update It does add dot files and dot directories by default. [ '.git\\', This got auto-watched when gaze was detection changes when I was watching the test.js file mentioned above. Most of the time it only seem to list all folders and sub-folders and put their name in an array without watching the files inside it. Making such huge array for nothing take a lot of resources, and why is it needed? What if I have 10k folders and watching one file in the root? The size of the array would be larger then what it can handle. I would either get a error telling me I'm running out of memory, or everything will slow down before it stops working. |
@rquadling You are right about that. And it will not even trigger events. Do this to reproduce:
Try to change content of the You can also rename folder @shama Is this going to be fixed? update! // triggers nothing
gaze('foo', handler)
// trigger only current folder and it sub files and folders
gaze('foo/*, handler)'
// adding files from root, and the folder. No files and sub folder inside foo added
gaze('foo/, handler)'
// trigger current folder and it sub files and folders and you get a lot of files and folder from root too
gaze('foo/**, handler)' |
Feel free to dive into the issue history of this repo. A lot being investigated here has already been discussed in other issues. Sorry I don't have the energy to link it for you.
Feel free to send a PR and I'll take a look. Thanks! |
@shama I have looked at most of the things already, and I just mention this to point out why things isn't worked as expected. I also found that your rewrite from 0.6 where you rolled back to 0.5, you skipped an important thing - check for absolute paths. I know this issue ticket regarding this matter: #203 But I think globule could handle it if you passed the option object. No idea if this is related to this issue ticket, but worth mention. Chokidar e.g. checking for absolute paths. .dot files and this missing things could be passed as an option to the globule module itself, but doesn't seem to do so. And just now I don't have time to anything. I just tried to figure out what all the issues was about. And there are too many issues with this module as I found, so I got confused. Shame indeed. I really prefer this module over chokidar. I like your API and the way this is build. @shama I could maybe have a done a PR for some of the issues, but when I noticed you have unsolved PR from 2 years back (soon 3 years), and also a pending one from august this year, I don't know. |
@rquadling @shama I can confirm most of this issues is related to the globule module, and not gaze itself. But there are tons of other issues with this module, so better I develop my own and move on. |
@crazyhuggins Sounds good! Thanks and best of luck! |
Hi.
I'm using grunt-contrib-watch which is using gaze v1.1.1.
My Gruntfile.js has a
watch
section in the config of:If I add some simple debugging to grunt-contrib-watch/tasks/watch.js, just before the call to Gaze();
I get output of:
which is exactly right for when I'm watching the config files.
The output I get next (provided by using
-v
option) is:But I can't get beyond this debugging as I don't know how to output content without grunt! If someone can point me to some easy debugging tools/info, I'll be happy to track this bug down.
If you were watching, you'll notice the commented out
build
section. If I use both sections, I still get the spurious entries. If I use ONLY thebuild
section, all is well, leading me to think that there something wrong when only files are being watched.I tried excluding directories, using relative paths, etc. all to no avail.
The text was updated successfully, but these errors were encountered: