-
-
Notifications
You must be signed in to change notification settings - Fork 28
Doesn't work with http.rb #17
Comments
If I comment out either of the tasks, so that only one task runs, the script executes without errors. So it's only that when running both of the tasks the exception occurs. |
In a way, this might be a bug in https://github.com/socketry/async/blob/master/lib/async/wrapper.rb#L141-L145
So, it represents a logic issue of sorts. You should probably isolate What's most likely happening is this (based on a quick look at http.rb's client implementation):
Because HTTP.rb is attempting to multiplex connections, it has problems. |
As an addendum, this issue happens because |
Yes, you were right. I somehow thought that require "http"
require "async"
require "async/io/tcp_socket"
require "async/io/ssl_socket"
options = {
socket_class: Async::IO::TCPSocket,
ssl_socket_class: Async::IO::SSLSocket,
}
Async.run do |task|
task.async do
http = HTTP::Client.new(options)
http.get("http://httpbin.org/delay/5").to_s
end
task.async do
http = HTTP::Client.new(options)
http.get("https://httpbin.org/delay/5").to_s
end
end Thanks for the help! |
You are most welcome! |
I like the idea of
async-io
giving you the ability to swap out Ruby's native socket class with the async counterpart. So I went to test this out with one library I know lets you do that – http.rb. Unfortunately, trying to run two requests in parallel raised anAsync::Wrapper::Cancelled
exception.Now, I'm not asking you to dive into the http.rb source code to debug this, but for starters I'm interested in what causes an
Async::Wrapper::Cancelled
exception.The text was updated successfully, but these errors were encountered: