-
-
Notifications
You must be signed in to change notification settings - Fork 698
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
Add --smoothing parameter for watchmedo --command to smooth over / ignore multiple triggering events. #231
Conversation
…er / ignore multiple triggering events.
Changes relate to Issue #136, which relates to a problem I was having with a software development IDE. Whenever the IDE makes changes to a source file, it generates more than a single filesystem event, and triggers multiple automatic builds. Using a |
HI. I'm not sure there's any need for this in the core api. Can you not add it in |
time.sleep(self._smoothing) | ||
|
||
if not event_queue.empty(): | ||
print("Smoothing over / ignoring {0} filesystem events that arrived after the triggering event.".format(event_queue.qsize())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
possible race condition here
I can give it a shot. The reason I believed I needed to add the smoothing parameter to drain the i.e. Using both parameters at the same time would lead me to believe that the command would "avoid multiple simultaneous instances" and "ignore events that happen while the previous process is still running". So it should run the command a single time, and ignore events that happen while that command is running. But what I see instead is the command being run serially multiple times when I do a |
On second thought: doesn't --no-parallel actually implement this? (awful name). https://github.com/gorakhargosh/watchdog/blob/master/src/watchdog/tricks/__init__.py#L94 returns immediately while the command is running. Author notes "This causes events that arrive while a process is still running to be silently ignored". Don't use --wait and --no-parallel simultaneously though. Then I think you have misunderstood. |
Ok, yes, that works. Meaning Issue #136 can be closed. But yeah, not the best naming. |
No description provided.