New creates a Runner that allows at most maxConcurrent simultaneous git subprocesses. If maxConcurrent <= 0 the default (16) is used.
(maxConcurrent int)
| 23 | // New creates a Runner that allows at most maxConcurrent simultaneous git |
| 24 | // subprocesses. If maxConcurrent <= 0 the default (16) is used. |
| 25 | func New(maxConcurrent int) *Runner { |
| 26 | if maxConcurrent <= 0 { |
| 27 | maxConcurrent = defaultMaxConcurrent |
| 28 | } |
| 29 | return &Runner{sem: make(chan struct{}, maxConcurrent)} |
| 30 | } |
| 31 | |
| 32 | func (r *Runner) acquire(ctx context.Context) error { |
| 33 | if r.sem == nil { |
no outgoing calls