No issue #
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@curii.com>
}
func (t *throttle) Acquire() {
}
func (t *throttle) Acquire() {
- t.setupOnce.Do(func() { t.ch = make(chan bool, t.Max) })
+ t.setupOnce.Do(func() {
+ if t.Max < 1 {
+ panic("throttle.Max < 1")
+ }
+ t.ch = make(chan bool, t.Max)
+ })
t.wg.Add(1)
t.ch <- true
}
t.wg.Add(1)
t.ch <- true
}
func (t *throttle) Go(f func() error) error {
t.Acquire()
if t.Err() != nil {
func (t *throttle) Go(f func() error) error {
t.Acquire()
if t.Err() != nil {
return t.Err()
}
go func() {
return t.Err()
}
go func() {