Sometimes I get multiple events in quick succession.
This wreaks havoc because pyinotify spawns sub-processes. This ends up with multiple parallel invocations of make build, resulting in race conditions.
One solution is to work on my Makefile to quickly exit if it detects a parallel invocation. Another is to find some UNIX-ish way to batch up calls to make buid somehow and only when 1 second of no more calls has elapsed, then release just one call to make build. Another solution is that I can submit this issue to you asking for a feature where it delays or batches up events before invoking the command. Here we go.
Ideas:
Add a --delay switch, which pauses so-many seconds before it invokes the command.
Add a --aggregate switch, which holds --delay seconds (1 second by default) and throws away any duplicate events.
One wrinkle is how to detect duplicate events in some flexible way. Is it duplicate by file name? Is it duplicate by event only?
When using it like so:
./venv/bin/python3 -m pyinotify -r -a -e IN_CLOSE_WRITE -c 'make build' src/
Sometimes I get multiple events in quick succession.
This wreaks havoc because pyinotify spawns sub-processes. This ends up with multiple parallel invocations of
make build
, resulting in race conditions.One solution is to work on my Makefile to quickly exit if it detects a parallel invocation. Another is to find some UNIX-ish way to batch up calls to
make buid
somehow and only when 1 second of no more calls has elapsed, then release just one call to make build. Another solution is that I can submit this issue to you asking for a feature where it delays or batches up events before invoking the command. Here we go.Ideas:
--delay
switch, which pauses so-many seconds before it invokes the command.--aggregate
switch, which holds --delay seconds (1 second by default) and throws away any duplicate events.One wrinkle is how to detect duplicate events in some flexible way. Is it duplicate by file name? Is it duplicate by event only?
Suggestion: