-
-
Notifications
You must be signed in to change notification settings - Fork 722
Description
I am using watchdog to watch a git repository and rerun a build process every time the repo changes.
I have observed that performing a git pull, for example, can cause watchdog to run repeatedly. I believe that the git pull is causing a very large number of files to change, and hence watchdog runs many times because watchdog runs once per file modification.
For me, this is not the desired behavior. If 5 files are modified at the same time, for example, I only need watchdog to run the build process once. I am hoping we can add a configuration option to watchdog to allow somebody to opt-in to the following proposed behavior "lazy run":
Proposed behavior "lazy run":
- Watchdog maintains a queue of file change events. This happens concurrently.
- Check the queue.
- If the queue is nonempty, empty the queue and run the process.
- (When the process is finished,) return to step 1.
Example of "lazy run" in action:
Suppose that the process to run takes a long time, and 5 files are modified in rapid succession.
- First file modified.
- modification 1 goes in queue
- watchdog empties queue and begins running the process
- Second file modified
- Third file modified
- Fourth file modified
- Fifth file modified
- modifications 2 through 5 are in the queue.
- The process completes and watchdog checks the queue again
- Modifications are discarded from the queue and watchdog begins running the process again
- The process completes again.
As you can see, in this example, even though 5 files were modified, the process only runs 2 times.