Skip to content
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

Observer and emitter timeout always set to 1 sec #916

Closed
abulgher opened this issue Aug 30, 2022 · 0 comments · Fixed by #986
Closed

Observer and emitter timeout always set to 1 sec #916

abulgher opened this issue Aug 30, 2022 · 0 comments · Fixed by #986
Labels

Comments

@abulgher
Copy link

Hi there!

I have implemented a mirroring handler that is replicating the content of a directory (recursive) to another (network) location on windows.

I have subclassed the PatternMatchingEventHandler and using the standard Observer.

When I create the observer I used something like:

my_observer = watchdog.observers.Observer(timeout=0.1)

Running on windows, the Observer constructor is returning an instance of watchdog.observers.read_directory_changes.WindowsApiObserver that I think it is the correct behavior.

I'm expecting that the event queue is checked every 0.1 s for new events to be dispatched. Is this correct?

What I am observing is that if a parallel process is creating a bunch of new directories in the monitored directory, the corresponding events are processed with 1 second delay in between independently of the timeout value. If I set a timeout value greater than 1 s in the Observer constructor, I get anyhow 1 second delay in between.

If the parallel process instead of a bunch of directories creates a bunch of files, the Observer is reacting much faster, more or less at the speed I would expected having set 0.1 s timeout.

Looking at the source code for the WindowsApiObserver I have noticed a 'HACK' named WATCHDOG_TRAVERSE_MOVED_DIR_DELAY = 1. Has this something to do with what I am seeing? If so, it would be probably better to document this expected behavior somewhere.

Watchdog version 2.1.9
Python version 3.10.5
Windows Server

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants