goferito / node-bing-api

Node.js module for the Bing Search API (Cognitive Services)
MIT License
56 stars 28 forks source link

what does ESOCKETTIMEDOUT mean? #30

Closed ralyodio closed 7 years ago

ralyodio commented 7 years ago

I raised reqTimeout: 10*1000 on the constructor. I'm still getting timeouts.

Don't know if I hit an API throttle limit or am doing something else wrong.

Now I'm getting ECONNRESET -- seems like I've been banned or something. But the API stats say I have plenty of queries left.

ralyodio commented 7 years ago

You need to add support for passing this:

,
      pool: {
        maxSockets: Infinity
      }

passed to request(). When I add that it works fine.

    request({
      uri: reqUri,
      method: opts.method || "GET",
      headers: {
          "User-Agent": opts.userAgent,
          "Ocp-Apim-Subscription-Key": opts.accKey
      },
      timeout: opts.reqTimeout,
      pool: {
        maxSockets: Infinity
      }