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

Don't rerun unnecessarily #55

Closed
relnod opened this issue Jun 29, 2018 · 3 comments · May be fixed by #101
Closed

Don't rerun unnecessarily #55

relnod opened this issue Jun 29, 2018 · 3 comments · May be fixed by #101

Comments

@relnod
Copy link

relnod commented Jun 29, 2018

Hi,
I have the problem, that it takes quite a while to run my prep commands. If I change a file three times and save it each time, the prep commands always get triggered, even if all file changes were already run on the second time.
Is it possible to add a check to see if a new run is unnecessary? So that when the prep command is running and I save two files during that time, the prep command only gets triggered once afterwards.

@cortesi
Copy link
Owner

cortesi commented Jul 21, 2018

This is tricky. We have a heuristic that batches up file changes until we see a lull, or reach a timeout. After that, changes are actioned. This is only a heuristic, and I don't think there's any way to tune this to satisfy all users in all circumstances.

To give me a bit more information to go on, could you please tell me:

  • Approximately how long your prep job takes to run
  • Approximately what interval are you making the changes at (e.g. one a second)
  • Which platform you're on

Also any further detail you think might apply.

@cortesi
Copy link
Owner

cortesi commented Dec 30, 2018

Closing, more info needed. Please re-open with some more info if you'd like me to pursue this.

@cortesi cortesi closed this as completed Dec 30, 2018
@pellared
Copy link

pellared commented May 13, 2020

@cortesi
I agree with @relnod.
Easy repro steps:

  1. Clone https://github.com/golang-templates/seed
  2. Run modd
  3. Open foo.go or foo_test.go
  4. Make some file changes e.g. add space and save the file
  5. Execute the previous step very fast a lot of times e.g. 30 times
  6. Notice that modd executes the build 30 times

I think you can add a state machine to modd. E.g.

  1. State "idle - waiting for file changes" - it watches for file changes. If a file is changed then you go to next state.
  2. State "executing prep - waiting for file changes" - start executing the prep. When the prep has finished then go to state 1. If a file changed during prep execution go to next state.
  3. State "executing prep - next prep execution queued". When the prep finishes then just go to previous step (rerun the prep and wait for new file changes).

Disclaimer, I had not time to look at modd source code.

Tested on v0.8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants