I'm running a small client in Go We're getting a number of false alarms at the moment, which seem to come down to client.Do() returning an EOF error when num>=1000
This is the essence of my code:
func DoCreate(js string) {
url2 := "http://ift.tt/1C2gLOE"
client := &http.Client{
CheckRedirect: nil,
}
postBytesReader := bytes.NewReader([]byte(js))
request, _ := http.NewRequest("POST", url2, postBytesReader)
resp, err := client.Do(request)
if err != nil {
fmt.Println(err) // Post http://ift.tt/1C2gLOE: EOF
return
}
body, _:= ioutil.ReadAll(resp.Body)
fmt.Println(string(body))
defer resp.Body.Close()
}
func main() {
for i := 0; i < num; i++ {
var pq CreateReqInfo
pq.Uid = strconv.Itoa(bid + i)
petstr, _ := json.Marshal(pq)
go DoCreate(string(petstr))
}
}
the problem about number of file handles or max connections?
Aucun commentaire:
Enregistrer un commentaire