node-statsd icon indicating copy to clipboard operation
node-statsd copied to clipboard

Added thrown error when cacheDNS flag fails to resolve dns name

Open ainsleyc opened this issue 10 years ago • 3 comments

Hello! Some justification for this throw:

Currently if the user passes a hostname to options.host without the cache flag on, the module will try to resolve the DNS name during runtime when the user tries to use any statsd function. The issue here is that if the DNS server cannot be reached, the server will crash.

The cacheDns flag allows an elegant way to allow users to opt out of this behavior. As long as the DNS name was successfully resolved when the module is initialized, the module will not cause the application to crash if DNS is not reachable.

To further reinforce this behavior, I think the the cacheDns lookup should immediately throw if the user passes an invalid hostname during initialization.

ainsleyc avatar Jul 22 '15 20:07 ainsleyc

This has been biting me, I assumed this would be the fix too. Any chance of this being merged any time soon? It's killing my 6 hour-ish long process over and over. I will just cache for now, didn't realise that was an option.

Olical avatar Jun 13 '16 13:06 Olical

Excuse my intrusion here, but nothing has been merged in this project for a long time. I started https://github.com/brightcove/hot-shots because of this, which includes this change.

bdeitte avatar Jun 13 '16 13:06 bdeitte

Ah, didn't realise this wasn't being maintained, thanks for the heads up, @bdeitte!

Olical avatar Jun 13 '16 14:06 Olical