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

Execute prep commands only once if there were many file changes during previous commands execution #86

Open
pellared opened this issue May 14, 2020 · 0 comments · May be fixed by #101
Open

Comments

@pellared
Copy link

pellared commented May 14, 2020

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

Tested with modd v0.8 on golang:1.14.2 Docker container.

I would prefer if modd would execute prep commands only once if there were many file changes during previous commands execution.

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 the 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 the previous step (rerun the prep and wait for new file changes).

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

Described also under #55

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.

1 participant