macfsevents icon indicating copy to clipboard operation
macfsevents copied to clipboard

How to know when Observer is ready ?

Open happygts opened this issue 10 years ago • 5 comments

Hello

I'm trying to develop software with your API. For some reason I want to know when the initialization of watchers is finished. Currently, I didn't find how to do that. First of all I wanted to know if it's possible, and if it's not I just added a boolean in Observer object and set it to true at the end of function run before loop(). This work but does this seem correct for you?

Thank you for your time and sorry for my bad English

happygts avatar Mar 31 '14 09:03 happygts

I'm not sure it's possible directly, but the FSEvents API supports historic events via the sinceWhen argument. That is, you could simply provide a sinceWhen value of the current time and then you ought to get all events if if the actual events stream takes some time to set up.

That said, macfsevents does not currently forward since parameter.

malthe avatar Mar 31 '14 09:03 malthe

Thank you, I am going to look at that. And what do you thing about the addition of the flag in fsevents.py in Observer ?

happygts avatar Mar 31 '14 09:03 happygts

I think it would be great to have that flag; unfortunately, I'm not on a Mac right now, so I can't really test it out.

malthe avatar Mar 31 '14 09:03 malthe

Ok, let me know after your test Have a good day.

happygts avatar Mar 31 '14 10:03 happygts

If you set file_events = True, it will take a snapshot (os.walk) on all the paths, this might take forever on large folder. If you don't use file_events, you can only know the PARENT path of the file in changes, then, since the file is already change, you will have no idea which file is changed in that folder and what kind of change is that, this is quite annoying, am I doing something wrong here ? , using the example, I can only get event arguments (path, 0,)

curlyz avatar Jan 25 '21 03:01 curlyz