Closed 6twenty closed 11 months ago
I've been digging into Node and DNS caching and have learned that any regular http
or https
calls in Node will use getaddrinfo
, a system call that will do DNS queries for both ipv4 (A) and ipv6 (AAAA) records, hence the pair of entries logged by my DNS server. It also doesn't support caching which is why the TTL is ignored and it queries the DNS server every time.
It also sounds like Node doesn't provide any mechanism for DNS caching anyway, even if you try to resolve a hostname using Node's DNS resolver class.
Bottom line is that this isn't an issue with this package, it's just the unfortunate nature of the underlying getaddrinfo
mechanism that Node uses.
Describe The Bug: I'm using AdGuard Home as a local DNS server. My homebridge server is querying "api.melview.net" twice every 5 seconds: once as an "A" query and once as a "AAAA" query. Not sure what the difference is between those but the "A" queries are returning with a TTL of between 700-4,500 seconds (it varies) which evidently isn't being respected. This doesn't cause any major problems but of the ~50 devices in my home network these queries alone represent over 20% of all DNS queries.
To Reproduce: I assume this is just the normal behaviour but you'd need a local DNS server to be able to see the DNS queries being performed.
Expected behavior: The TTL of the DNS queries should be respected which would reduce the number of requests from 2 every 5 seconds to (presumably) 2 every [TTL].
Logs: There aren't any logs that correlate to these DNS queries, even with debug logging enabled.
Plugin Config:
Screenshots:
Environment: