http
http copied to clipboard
[Feature] Ruby 3 Ractor support?
Ruby 3 support Ractor to archive concurrency, Ractor can not access instance variables of classes/modules.
When I want to use Ractor with http, I found http is using access instance variables of classes, for example:
require 'http'
ractors = []
url = 'http://httpbin.org/ip'
10.times do
ractors << Ractor.new(url) { |u| HTTP.get u }
end
ractors.map(&:take)
This snippet will raise error http-4.4.1/lib/http/chainable.rb:221:in 'default_options': can not access instance variables of classes/modules from non-main Ractors (Ractor::IsolationError), because http using default_options as class instance variable.
Is it possible to make it support Ractor?