Kong / lua-resty-dns-client

Lua DNS client, load balancer, and utility library
http://kong.github.io/lua-resty-dns-client/topics/README.md.html
Apache License 2.0
152 stars 52 forks source link

fix(client) ensure `validTtl` override does not interfere with TTL of #134

Closed dndx closed 3 years ago

dndx commented 3 years ago

entries from hosts files

See: https://github.com/Kong/kong/issues/7444 for bug report

The validTtl setting forcibly overwrites TTL inside the cacheinsert function. However, this inadvertently overrides the TTL of hosts file entries as well so that they may expire prematurely, causing resolving failures later.

This PR changes so that validTtl will only be enabled after all entries from hosts file are inserted.