question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Implement connection queueing to avoid nodejs connection limits

See original GitHub issue

I sometimes get this error after doing some requests:

{ [Error: getaddrinfo ENOTFOUND www.googleapis.com www.googleapis.com:443]
  code: 'ENOTFOUND',
  errno: 'ENOTFOUND',
  syscall: 'getaddrinfo',
  hostname: 'www.googleapis.com',
  host: 'www.googleapis.com',
  port: 443 }

Here is the last request I’m recording:

{ url: 'https://www.googleapis.com/youtube/v3/channels',
  method: 'GET',
  json: true,
  qs: { part: 'id, contentDetails', id: 'UChu4DxadETMAMlgwBREcNvQ' },
  useQuerystring: true,
  headers: { Authorization: 'Bearer mytoken' } }

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:15
  • Comments:24 (10 by maintainers)

github_iconTop GitHub Comments

3reactions
JustinBeckwithcommented, Mar 23, 2019

Greetings folks! I’d love to do something here, but with hundreds of API endpoints, it’s hard to come up with a unified queuing strategy that’s going to work for everyone. There’s no magic concurrency that’s going to be right for anyone, and changing the current behavior would be a breaking change for many.

Instead - I am going to recommend that y’all take a look at p-queue: https://github.com/sindresorhus/p-queue

We use this internally for a lot of our modules, and we’ve been really happy with it. Using this with googleapis should be pretty easy 😃

Let us know what you think!

3reactions
jmdobrycommented, Mar 4, 2016

getaddrinfo ENOTFOUND sounds like a connectivity, or that it’s intermittently failing to resolve the dns. I’ll have to give your code a try.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Avoid Bottlenecks in Node.js Applications
In this article, we looked at how connection pools may become bottlenecks in your Node.js application. Knowing what a connection pool is and...
Read more >
Understanding and implementing rate limiting in Node.js
As requests get queued up, they are processed at a relatively constant rate. This means that even when the server is hit with...
Read more >
Effect of connection pooling on node.js performance
The benefit of connection pooling is only when we run multiple requests together. So now, lets execute in series of 5 queries as...
Read more >
Why is node.js only processing six requests at a time?
There are no TCP connection limits imposed by Node itself. (The whole point is that it's highly concurrent and can handle thousands of ......
Read more >
Don't Block the Event Loop (or the Worker Pool) - Node.js
Because Node.js handles many clients with few threads, if a thread blocks handling one client's request, then pending client requests may not get...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found