-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Fix connection for multiple dns hosts #2447
Conversation
Codecov Report
@@ Coverage Diff @@
## 2.3 #2447 +/- ##
==========================================
+ Coverage 97.24% 97.25% +0.01%
==========================================
Files 39 39
Lines 8231 8238 +7
Branches 1442 1442
==========================================
+ Hits 8004 8012 +8
Misses 98 98
+ Partials 129 128 -1
Continue to review full report at Codecov.
|
Yeps, Maybe Im reading in the wrong way but looks like you are trying to implement a kind of failover or circuit breaker pattern inside the logic of the IMHO this is a bad idea and it makes the API not predictable. What happen if we wanna log in our app each time that there is an error connecting to a specific IP address ? What to do with the errors at this level has to be done by upper layers, these layers that are in the domain of the developer. |
asyncio itself has this functionality. Aiohttp had it prior 2.3.0, where it was removed by mistake. I am trying to fix my own mistakes. I was talking with @asvetlov offline regarding logging of failed connections and decision was do not implement it, cuz asyncio do not log it |
Another solution instead of logging can be raise each new exception from previous one |
@hellysmile can you give me a link which shows how this is implemented by "asyncio" and another one that shows how it was implemented before by aiohttp? |
You are right, thanks for the info! |
@pfreixes can I ask You for a review? |
aiohttp/connector.py
Outdated
return transp, proto | ||
else: | ||
assert last_exc is not None |
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.
Just drop the line.
Check doesn't point on potential problem, next line will fail enyway (raise None is forbidden in Python 3).
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.
lgtm
* Fix wrap oserrors. (#2442) * Fix wrap oserrors. * Skip unix socket tests on windows * Fix wrap ssl errors for proxy connector. (#2446) * Fix 2451: Rename from_env to trust_env in client reference. * Fix connection for multiple dns hosts (#2447) * Proof of concept fix for multiple dns hosts * Revert getpeercert * Added test for multiple dns hosts and errors. * Added change notes. * Remove redunant assert. * Minor docs formatting * Move TOC to separate RST file * Build tarball on appveyor * Bump to 2.3.2b1 * @asyncio.coroutine -> async * Update index.rst * Update toc.rst
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. |
What do these changes do?
Fix for
aiohttp.connector.TCPConnector._create_direct_connection
tries to use all of dns hosts from dns response to connect one by oneRelated issue number
#2424
Checklist
CONTRIBUTORS.txt
CHANGES
folder<issue_id>.<type>
for example (588.bug)issue_id
change it to the pr id after creating the pr.feature
: Signifying a new feature..bugfix
: Signifying a bug fix..doc
: Signifying a documentation improvement..removal
: Signifying a deprecation or removal of public API..misc
: A ticket has been closed, but it is not of interest to users.