The docs say the AsyncResolver is the default resolver used when aiodns is installed but this is not really the case.
Here's what current stable docs say:
Changed in version 1.0: The resolver is aiohttp.AsyncResolver now if aiodns is installed.
AsyncResolver being the default resolver when aiodns is installed.
ThreadedResolver is used.
aiodns: pip install aiodns.AsyncResolver is default:I'm using aiohttp version 2.2.3 with Python 3.5.2 on Ubuntu 16.04.3.
In /aiohttp/resolver.py we can clearly see this line:
aiodns_default = False
And then later on:
DefaultResolver = AsyncResolver if aiodns_default else ThreadedResolver
Doc should reflect current state.
See #559 for information about disabling async resolver by default.
Is it possible to explicitly set async resolver globally, or does it need to be set for each client session?
No global state :)
Usually you should not create too many sessions but do it in very little places in your program.
thanks @asvetlov .
So when using a session, the way to do it is by passing it a connector with async resolver? i.e.
ClientSession(connector=aiohttp.TCPConnector(resolver=aiohttp.AsyncResolver()))
Yes
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a [new issue] for related bugs.
If you feel like there's important points made in this discussion, please include those exceprts into that [new issue].
Most helpful comment
thanks @asvetlov .
So when using a session, the way to do it is by passing it a connector with async resolver? i.e.
ClientSession(connector=aiohttp.TCPConnector(resolver=aiohttp.AsyncResolver()))