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

Add build.Limiter #79

Merged
merged 4 commits into from
Sep 11, 2019
Merged

Conversation

jonjohnsonjr
Copy link
Collaborator

You can limit the number of concurrent builds with -j (a la make).

The default value for this is GOMAXPROCS, which seems reasonable.

cc @JungukCho

You can limit the number of concurrent builds with -j (a la make).

The default value for this is GOMAXPROCS, which seems reasonable.
pkg/commands/options/build.go Outdated Show resolved Hide resolved
// Build implements Interface
func (l *Limiter) Build(ip string) (v1.Image, error) {
// TODO(jonjohnsonjr): Build should take a context.Context.
if err := l.semaphore.Acquire(context.TODO(), 1); err != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any reason not to use sync.WaitGroup? I'm unfamiliar with the semaphore package, but it seems like it's main benefit is weightedness, which we're not taking advantage of here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WaitGroup is similar, but AFAICT there is no way to bound the maximum number of the counter, whereas NewWeighted takes a maximum weight.

@jonjohnsonjr jonjohnsonjr merged commit 99a587e into ko-build:master Sep 11, 2019
@jonjohnsonjr jonjohnsonjr deleted the limit-builds branch September 11, 2019 17:07
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 this pull request may close these issues.

3 participants