29 lines
397 B
Go
29 lines
397 B
Go
package linode
|
|
|
|
import (
|
|
"errors"
|
|
"fmt"
|
|
"github.com/xxjwxc/gowp/workpool"
|
|
"testing"
|
|
)
|
|
|
|
func TestAA(t *testing.T) {
|
|
wp := workpool.New(100)
|
|
for i := 0; i < 200000; i++ {
|
|
var t = i
|
|
wp.Do(func() error {
|
|
fmt.Println(t)
|
|
if t == 22 {
|
|
return errors.New("111")
|
|
}
|
|
return nil
|
|
})
|
|
}
|
|
err := wp.Wait()
|
|
if err != nil {
|
|
fmt.Println("fail", err)
|
|
} else {
|
|
fmt.Println("OK")
|
|
}
|
|
}
|