Max Williams
2008-Sep-27 15:48 UTC
make a system call and proceed without waiting for result?
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? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Craig White
2008-Sep-27 20:59 UTC
Re: ****[Rails] make a system call and proceed without waiting for result?
On Sat, 2008-09-27 at 17:48 +0200, Max Williams wrote:> 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?---- backgroundrb Craig --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
blasterpal
2008-Sep-28 02:07 UTC
Re: ****[Rails] make a system call and proceed without waiting for result?
Even simpler. Use ruby ''fork'' method. Example: #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 On Sep 27, 4:59 pm, Craig White <craigwh...-BQ75lA0ptkhBDgjK7y7TUQ@public.gmane.org> wrote:> On Sat, 2008-09-27 at 17:48 +0200, Max Williams wrote: > > 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? > > ---- > backgroundrb > > Craig--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Max Williams
2008-Oct-02 08:10 UTC
Re: ****[Rails] make a system call and proceed without waiting for result?
blasterpal wrote:> Even simpler. Use ruby ''fork'' method. Example: > > #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.nowGreat, thanks guys! -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---