Skip to content

Context managed transports - #1218

Merged
lovelydinosaur merged 6 commits into
masterfrom
context-managed-transports
Aug 26, 2020
Merged

Context managed transports#1218
lovelydinosaur merged 6 commits into
masterfrom
context-managed-transports

Conversation

@lovelydinosaur

@lovelydinosaurlovelydinosaur commented Aug 26, 2020

Copy link
Copy Markdown
Contributor

Closeshttps://github.com/encode/httpx/issues/1145

Note that once #977 is addressed we'll be able to test the proxies case more elegantly.

We're not being clever here about "ensure other transports still close if an exceptions occurs during __exit__ in one transport". (Or the other fiddly case, of ensuring the __exit__ is called on any already __enter__'d transports, if an exception occurs during __enter__.)

I think we should probably treat that as a follow up, and it's possible that we might only want to do so once #977 is addressed.

I think thats probably an okay approach to take since it's not any worse than our existing behaviour, which anyway doesn't handle "ensure other transports still close if an exceptions occurs during close in one transport", and besides exceptions during transport __enter__/__exit__ are pretty much unrecoverable issues, and it's not really any worse if they happen to potentially leave other transports hanging open.

(Actually having talked through it I'm not event convinced that we should bother handling that case at all, but either way let's talk it through as a follow-up)

Comment threadhttpx/_client.py Outdated
Comment threadhttpx/_client.py Outdated
Comment threadtests/client/test_async_client.py Outdated
Comment threadtests/client/test_client.py Outdated
Comment threadtests/client/test_async_client.py
lovelydinosaurand others added 4 commits August 26, 2020 11:54
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
Co-authored-by: Florimond Manca <florimond.manca@gmail.com>
@lovelydinosaur

Copy link
Copy Markdown
ContributorAuthor

@florimondmanca Your reviews are always on-point. Wonderful, thank you. ✨🔥✨

@florimondmancaflorimondmanca left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

@lovelydinosaur
lovelydinosaur merged commit 534400e into masterAug 26, 2020
@lovelydinosaur
lovelydinosaur deleted the context-managed-transports branch August 26, 2020 11:05
@lovelydinosaurlovelydinosaur mentioned this pull request Sep 2, 2020
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Context Managed Transports

2 participants

@lovelydinosaur@florimondmanca