This is probably a general ruby question: in one of my models i need to
make loads (up to 600 or so) of system calls with the curl command.
It’s a fire-and-forget kind of deal - i don’t care, at that particular
moment, whether the calls were successful or not and i certainly don’t
want to keep the user waiting for the html responses to come back.
Is it possible, with a call to ‘system’ (or some other method) to carry
on without waiting for the results?
This is probably a general ruby question: in one of my models i need to
make loads (up to 600 or so) of system calls with the curl command.
It’s a fire-and-forget kind of deal - i don’t care, at that particular
moment, whether the calls were successful or not and i certainly don’t
want to keep the user waiting for the html responses to come back.
Is it possible, with a call to ‘system’ (or some other method) to carry
on without waiting for the results?
#show time now
puts Time.now
fork do #long running process sleep 20;curl -O www.somesite.com/bigfile.tgz
end #this time is nearly same as when we started, no delay
puts Time.now
#show time now
puts Time.now
fork do #long running process sleep 20;curl -O www.somesite.com/bigfile.tgz
end #this time is nearly same as when we started, no delay
puts Time.now
Great, thanks guys!
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.