Question about watch node?

I am not sure I understand the following...

Note: The directory or file must exist in order to be watched. If the file or directory gets deleted it may no longer be monitored even if it gets re-created.

If I have a flow that creates a file, I can't use a watch node to get the file size of the file I just created? That is what the above note implies to me. Can someone clarify if a watch node will or will not work correctly on a file just created?

It means what it says... It can't get a handle on something that doesn't exist. So to watch for files being created you need to watch the directory they are in - not the filename you think they will be created as.

What is the mechanism that is used? The inode? Something else? If the file exists, the watch node created, then the file is deleted and created again, this works. I have a flow right now that has never failed that matches the scenario I just noted.

You can watch for the flows file to be recreated on a deployment with a watch node for example. So I am trying to understand what the circumstances are for failure of a watch node, when right now, I have an example, where it does not fail. The 'may' wording needs some qualification in context of my question.

Per my understanding the flows file is a safe-save model, so could that be contributing factor? Fie content is replaced but file (handle) is not actually removed from the file system?

it uses fs.stat (I think). I'm sure there was once a situation where on some OS they did not all behave the same. (maybe those without inodes)

Cool. thanks for the info. Gives me a place to start. :slight_smile: Right, usually when something is qualified, similar to this, OS specific limits can come into scope. Fortunately, I only have Linux/Pi based infrastructure. But I want to have at least one Windows based system for reference at some point as well.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.