Giter Club home page Giter Club logo

Comments (5)

epappas avatar epappas commented on July 21, 2024

Hi, I am having the same issue. Have you any workaround on this? I suppose I could create a watch monitor when the a1 is created, any better thought on this?

Cheers!

Edit: Thought in my case this is what happens; When A folder is created, and a1 recursively, the issue persists. If in any future time (more than 3 sec) a a2 folder is created, the event triggers a create event for the a2.

I have tried to delay the recursion of folder creation by 1-2 ms but the issue persists.

mind; OS X 10.9.2

from watch.

qlqllu avatar qlqllu commented on July 21, 2024

Yes, I agree with you, I create a new monitor when a1 is created. It's better that the library fixes this issue.

from watch.

jimrae avatar jimrae commented on July 21, 2024

I am also having this issue (Windows 7). My specific scenario is that I want to monitor a specific file in a subfolder. Unfortunately, the application that creates this file deletes the folder it is in, and recreates it (the folder) and the file as well. I tried monitoring the subfolder, but had issues when the subfolder got deleted and recreated quickly, either I would get an error that the file was in use from my source application, which I think was the watcher reading the stat at the same time as the os was deleting the directory, which caused the source app to fail. When I changed my node.js code to monitor the higher level folder, that error did not occur, but I do not consistently detect that my file of interest has been created or updated.
If anyone has suggestions on a better implementation that works more consistently, I would appreciate the feedback.

from watch.

fyddaben avatar fyddaben commented on July 21, 2024

i have same problem ,when i use yeoman to generate a folder and many files in a folder.it only watch foler created,but the file cant fired.

from watch.

Apteryx0 avatar Apteryx0 commented on July 21, 2024

From the inotify man page:

Limitations and caveats
Inotify monitoring of directories is not recursive: to monitor subdirectories under a directory, additional watches must be created. This can take a significant amount time for large directory trees.

Watch seems to be adding new watches as they get added to watched tree - however, it doesn't take into account this:

If monitoring an entire directory subtree, and a new subdirectory is created in that tree, be aware that by the time you create a watch for the new subdirectory, new files may already have been created in the subdirectory.
Therefore, you may want to scan the contents of the subdirectory immediately after adding the watch.

So if you create a new directory, wait, and then copy files into it then everything will work properly. If you copy the files immediately after the directory create (or copy an entire directory structure) then you will not get notifications for those files (but you should for subsequent files).

Note, if you create a directory with a sub-directory in quick order you will never receive any notifications, even for files created much later. This is because watch fails to do an inotify_add_watch call for the (from it's point of view) pre-existing sub-directory in the new directory. I've seen this with my thumbnailing service which fails to create thumbnails if I do this:

Working - delay between directory, sub-directory and file creation:

root@cloud2:/var/www/data/dev/dt_user_files# mkdir -v 42426; sleep 10; mkdir -v 42426/lessons; sleep 10; cp -v 36974/lessons/1295.mp4 42426/lessons/
mkdir: created directory `42426'
mkdir: created directory `42426/lessons'
`36974/lessons/1295.mp4' -> `42426/lessons/1295.mp4'
root@cloud2:/var/www/data/dev/dt_user_files# ls -la 42426/lessons/
total 448
drwxr-xr-x 2 root root   4096 2015-12-11 10:28 .
drwxr-xr-x 3 root root   4096 2015-12-11 10:27 ..
-rw-r--r-- 1 root root  12024 2015-12-11 10:28 1295.jpg
-rw-r--r-- 1 root root 435702 2015-12-11 10:28 1295.mp4
root@cloud2:/var/www/data/dev/dt_user_files#

Non-working - no delay between directory and sub-directory creation:

root@cloud2:/var/www/data/dev/dt_user_files# mkdir -p -v 42429/lessons; sleep 10; cp -v 36974/lessons/1295.mp4 42429/lessons/; sleep 10; ls -la 42429/lessons
mkdir: created directory `42429'
mkdir: created directory `42429/lessons'
`36974/lessons/1295.mp4' -> `42429/lessons/1295.mp4'
total 436
drwxr-xr-x 2 root root   4096 2015-12-11 10:39 .
drwxr-xr-x 3 root root   4096 2015-12-11 10:39 ..
-rw-r--r-- 1 root root 435702 2015-12-11 10:39 1295.mp4
You have mail in /var/mail/root
root@cloud2:/var/www/data/dev/dt_user_files#

from watch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.