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

[1.24.1] Command is run multiple times #726

Closed
tminich opened this issue Dec 12, 2023 · 9 comments · Fixed by #734
Closed

[1.24.1] Command is run multiple times #726

tminich opened this issue Dec 12, 2023 · 9 comments · Fixed by #734
Labels
bug Something's not right! need repro Needs a reproduction and some investigation

Comments

@tminich
Copy link

tminich commented Dec 12, 2023

After updating to 1.24.0/1.24.1 it seems like the command is run for each event rather than once for each batch. I hadn't used debounce so far, but even that doesn't help (technically in my case makes it even worse, as I'm running a directory sync that now runs several times at once conflicting).

OS: Windows
Command line:

watchexec -w "C:\devel\laravel" --project-origin "C:\devel\laravel" --no-default-ignore --no-vcs-ignore --no-project-ignore --no-global-ignore --no-meta -d 2 --ignore-file "C:\devel\exclude.watchexec" <command>
@tminich tminich added the bug Something's not right! label Dec 12, 2023
@passcod
Copy link
Member

passcod commented Dec 12, 2023

I'll look into this but as an aside you can replace --no-default-ignore --no-vcs-ignore --no-project-ignore --no-global-ignore with --ignore-nothing. Note that -d with a unitless value interprets it as milliseconds, so indeed that might be worse than the default (50ms).

@tminich
Copy link
Author

tminich commented Dec 12, 2023

Ah, I missed that, thanks. Trying now with a sane value =)
Nevertheless, no matter what your review yields, might be worth to consider implementing at least two execution modes, one that ensures the command never runs in parallel and one that runs the command for every update.

@tminich
Copy link
Author

tminich commented Dec 12, 2023

Looks good now. I suspect between versions timings subtly changed and the debounce default was fine before but now caused issues?

@passcod
Copy link
Member

passcod commented Dec 12, 2023

one that ensures the command never runs in parallel and one that runs the command for every update.

That should already be the case, unless there's a race condition very early, there's no way for current Watchexec to have two simultaneous runs of a process unless the command is detaching itself (in which case Watchexec is no longer in control of it).

In fact the current default is for events received during a run to queue up a subsequent run when the current one stops. You may want --on-busy-update=do-nothing to ignore changes while the command is currently running instead.

@tminich
Copy link
Author

tminich commented Dec 12, 2023

Then indeed something seems to be wrong, the command ran multiple times in parallel. The way you describe the intended default behavior is exactly how I want it to run: if something triggers during a run, finish the run and then run again (once).

@passcod
Copy link
Member

passcod commented Dec 12, 2023

Well, that's annoying, but at this point I need your command, or something like your command that behaves the same if there's privacy issues here, to replicate this. And if possible, a logfile at -vvv level or higher.

@passcod passcod added the need repro Needs a reproduction and some investigation label Dec 12, 2023
@tminich
Copy link
Author

tminich commented Dec 12, 2023

rclone.exe sync -M -v --local-no-preallocate --local-no-sparse --exclude .env --fast-list --exclude-from C:\devel\exclude.rclone C:\devel\laravel \\WSL$\UBUNTU-22.04\home\tminich\devel\laravel

I cut the paths down a bit, but that shouldn't matter. Any somewhat sizable repository as a sync source should work.

@passcod
Copy link
Member

passcod commented Dec 15, 2023

Aight, got a reproduction, I'll get a fix out soon
image

@tminich
Copy link
Author

tminich commented Dec 15, 2023

Thanks, I'll check when I'm back at work early January.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something's not right! need repro Needs a reproduction and some investigation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants