I
I
Ildar Gizetdinov2018-05-25 20:55:38
API
Ildar Gizetdinov, 2018-05-25 20:55:38

Error with a large number of outgoing HTTPS requests?

Error #1: TLS: Handshake timeout
Error #2: write: broken pipe

About 20k concurrent connections are being made

var HTTPClient = http.Client{
  Timeout: time.Duration(45 * time.Second),
}

func RequestLongPoll(url string) []byte {
  httpResponse, err := HTTPClient.Get(url)
  if err != nil || httpResponse == nil {
    fmt.Println(err.Error())

    return nil
  }

  defer httpResponse.Body.Close()
  bodyBuffer, err := ioutil.ReadAll(httpResponse.Body)
  if err != nil || bodyBuffer == nil {
    fmt.Println(err.Error())

    return nil
  }

  return bodyBuffer
}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Q
qazar, 2018-05-29
@KFan

https://stackoverflow.com/questions/32523521/golan...
here is a way to increase TLSHandshakeTimeout

V
Vitaly F., 2018-05-27
@FuN_ViT

Perhaps the API has a limit on the number of connections from IP?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question