-
Notifications
You must be signed in to change notification settings - Fork 557
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 async http adapter #901
Conversation
Problem: the server in Async::HTTP::WebMockEndpoint#accept_socket was hanging forever after the rspec example finished. This is normal as Async::HTTP::Server (or any server) is never supposed to end. It just continues waiting for new requests which, in this case, never come. Solution: use a 'transient' async task when starting a server. Transient tasks do not block an exiting async reactor. So, in this case a transient server will not hang forever. Fixes bblimke#858
@ioquatix I just saw your latest comment #858 (comment) Here is the "expanded" code from this PR: Async(transient: true) do # <= This task IS the server's task
server = Async::HTTP::Server.new(WebMockApplication, self)
server.accept(socket, socket.remote_address)
end Is the |
It looks okay to me - let's try it as implemented and check how it works. |
@bruno- @ioquatix actually the build is now failing: https://travis-ci.org/github/bblimke/webmock/jobs/725160832 |
I'm checking this. |
@bblimke it seems travis is using Can we bump travis version? Maybe delete travis' cache or something? |
@bruno- I now see that it's only a problem on Ruby 2.3 and 2.4 which are likely not compatible with latest async version. 2.3 and 2.4 are EOL so I guess I can drop support for them anyway. |
I have an unpublished policy for open source, I do not support EOL Rubies. |
@bblimke looking forward to next webmock gem release that contains these fixes. |
This has now been released as version 3.9.0 |
Problem: the server in Async::HTTP::WebMockEndpoint#accept_socket was
hanging forever after the rspec example finished.
This is normal as Async::HTTP::Server (or any server) is never supposed
to end. It just continues waiting for new requests which, in this case,
never come.
Solution: use a 'transient' async task when starting a server.
Transient tasks do not block an exiting async reactor.
So, in this case a transient server will not hang forever.
Fixes #858
@ioquatix we talked about making this a draft PR so we can continue talking about a proper webmock <-> async-http solution. Since this fix is minimal I propose going for a merge.
We can continue thinking about a better approach here socketry/async-http#35