make client concurrent
This commit is contained in:
parent
6000071bb6
commit
c0406348f6
@ -32,12 +32,17 @@ func main() {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
s := make(chan bool, 10)
|
||||
for i := 0; ; i++ {
|
||||
s <- true
|
||||
go func(j int) {
|
||||
resp, err := c.Hello(ctx, &pb.HelloReq{Subject: strings.Join(os.Args[2:], " ")})
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "hello: %#v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
fmt.Printf("0x%08x: %#v\n", i, resp)
|
||||
fmt.Printf("0x%08x: %#v\n", j, resp)
|
||||
<-s
|
||||
}(i)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user