-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new ttl option to expire DNS entries after N seconds #1819
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1819 +/- ##
==========================================
+ Coverage 97.18% 97.23% +0.04%
==========================================
Files 37 37
Lines 7467 7478 +11
Branches 1297 1299 +2
==========================================
+ Hits 7257 7271 +14
+ Misses 89 87 -2
+ Partials 121 120 -1
Continue to review full report at Codecov.
|
Hi @pfreixes, Normally, you have a ttl at server side for each DNS record. Thanks for your answer. |
Hi @GMLudo, Unfortunately, retrieve the TTL as a related metadata of a DNS query can end up being a mess, the default implementation of IMHO the current commit avoids all of this complexity just adding a new user parameter, with that the user has the chance to avoid having wrong entries in his DNS cache and also taking advantage of the cache yet. In fact, I would prefer to put some value such as 60 seconds per default ... but it could create too much controversial because of breaking change. There is a discussion also open in the Tornado repo about that [2] Yes, If I'm not wrong a [1] http://man7.org/linux/man-pages/man3/getaddrinfo.3.html |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you use loop.time() instead of monotonic.
I like your changes. could you just use loop.time() instead of monotonic. |
some more notes:
|
Hi @pfreixes, Thanks for your explanations, it's now clear to me, and thanks for your pull request BTW ;-) Have a nice week. |
@fafhrd91 done. The documentation was already there and I've contributed before and I was already in at CONTRIBUTORS.rst file FYI This week I'm gonna work in give support for multiple hosts address per hostname, it might mean some changes in TCPConnector and the DNS resolvers. The question is how backward compatibility has to be the [1] https://github.com/aio-libs/aiohttp/blob/master/aiohttp/connector.py#L590 |
I've renamed a bit the unit tests about the DNS stuff, just let me know if you are happier with the new approx. |
this option to keep the DNS cache updated refreshing each entry after N | ||
seconds. | ||
|
||
.. versionadded:: 2.0.8 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change it to 2.1
thanks! |
What do these changes do?
Add a new option to expire DNS cached entries at some point, this will avoid having invalid DNS entries for those environments where translations changes in some time policy.
Are there changes in behavior for the user?
By default it behaves as backward compatibility, entries are cached forever. Using the new
ttl_dns_cache
parameter the user can specify how many seconds a DNS entry will be keep into the table before to be refreshed.Checklist
CONTRIBUTORS.txt
CHANGES.rst
#issue_number
format at the end of changelog message. Use Pull Request number if there are no issues for PR or PR covers the issue only partially.