Given a file looks like below:
Thread.new {
(1..10).each do |e|
`curl http://localhost/#{e}`
end
}
sleep 0.03
puts "--- done"
When running this file, I found the "child thread" exits when it only sent 4-5 HTTP requests.
My question is: is this because the "ruby intepreter" exited? (so all the ruby threads terminated?)
How could I keep the "child thread" running when the "main thread" terminated?
If I run this code in ruby webservers such as thin, puma, does this problem exist?
Thank you.