modify ExampleNew_MultiConn_Recommend function

This commit is contained in:
huangqian
2022-05-13 11:58:46 +08:00
parent e27ca17b0e
commit f82f53f5f6

View File

@ -128,16 +128,13 @@ func ExampleNew_MultiConn_Recommend() {
client.Transport.(*http.Transport).MaxIdleConnsPerHost = 5
for i := 0; i < 5; i++ {
go func() {
if r, err := client.Get(ctx, "http://127.0.0.1:8999/var/json"); err != nil {
panic(err)
} else {
fmt.Println(r.ReadAllString())
r.Close()
}
}()
if r, err := client.Get(ctx, "http://127.0.0.1:8999/var/json"); err != nil {
panic(err)
} else {
fmt.Println(r.ReadAllString())
r.Close()
}
}
time.Sleep(time.Second * 1)
// Output:
//{"id":1,"name":"john"}