watchdog spams file_opened events
rbachleitner opened this issue · comments
Hi there,
I don't know what happened since 2.2.1,
but in 2.3.0 we noticed that watchdog was spamming file_opened events on many if not
all files in the --patterns
flag and restarting our service.
We are using a watchmedo auto-restart like follows
watchmedo", \
"auto-restart", \
"--patterns", \
"*.py", \
"--recursive", \
"--", \
"python3",
... flask commands follow
(formatting due to using it in a Dockerfile);
Our *.py files didn't show any actual change (checked via git & ls -a),
but watchdog was logging a lot of file_opened events and sending the KeyboardInterrrupt.
For now we reverted to 2.2.1.
Thanks for the report.
You are right, the new "file opened" event is included by default in all events: https://github.com/gorakhargosh/watchdog/blob/v2.3.0/src/watchdog/events.py#L289
I should have catch that in #941, and will revert the change (users wanting to catch those events will have to use .on_opened()
). Until we can actually filter by event types.
Could you try the version from the master
branch (as of commit 346ee46)? If it fixes your issue, the release will be done right after.
Thanks, latest master works in not triggering autorestart on FileOpenedEvent.
Thanks @jthurner, release is on the way :)
v2.3.1 is out!