Drop run and run_in_threadpool#710
Conversation
|
Yes, I remember server restarts have already been the cause of some headaches in the past… #276 (comment) As far as understanding the error message, it's already been discussed in https://github.com/encode/httpx/issues/96 — basically the server abruptly closed the connection (which it did). We're making a blocking call in the main thread via Actually, if we turn Luckily, we have an agnostic Lemme push a commit to demonstrate the idea… |
ef7625a to
83612a1
Compare
|
Note that these connection pool tests run faster now, because we don't have to setup/teardown a thread on each restart. 😄 |
83612a1 to
1186d66
Compare
|
@florimondmanca Thanks, great stuff! I've now also dropped Also cleaned up the |
We're no longer using the backend methods
runandrun_in_threadpoolwithin thehttpxcodebase, so this PR removes them.We are however using them within the test cases in order to perform the server restarts.
I've changed things around so that
.restart()is a standard blocking function (It may as well be, and it runs from a different thread from the server, so it won't block the server itself from shutting down.)However, the tests that use
server.restart()are currently failing in theasynciocase. (With h11 errors that the server close event is occuring at a point that it should not.) Really not clear to me why we'd see that with asyncio but not with trio. I think that are resolution here might be that restart should perform a full shutdown, and reopen the server on an entirely new thread, to keep things cleaner?Any thoughts on this @florimondmanca?