Any one know if it is possible to do a non-blocking http request within Ror? I looked at Net::HTTP, nothing obvious. In my code, I want to fire off a http request (and not care about the return or wait for it) and continue with the rest of the work. I know I can use backgroundrb etc - but that seems an overkill. Any help appreciated. thanks.
Seriously, checkout delayed_job. It''s super easy to implement, and is anything but overkill. Here''s the URL for the project: http://github.com/collectiveidea/delayed_job ... and as an added bonus, Ryan Bates covers it in a Railscast. Here''s the URL for the Railscast: http://railscasts.com/episodes/171-delayed-job Cheers, Tim On Thu, Sep 24, 2009 at 4:27 PM, nextpulse <robert-pZCIFDiVgMdl57MIdRCFDg@public.gmane.org> wrote:> > Any one know if it is possible to do a non-blocking http request > within Ror? > > I looked at Net::HTTP, nothing obvious. > > In my code, I want to fire off a http request (and not care about the > return or wait for it) and continue with the rest of the work. > I know I can use backgroundrb etc - but that seems an overkill. > > Any help appreciated. > > thanks. > > > >-- Tim Lowrimore Coroutine LLC 516 Tennessee St., Suite 215 Memphis, TN 38103 office: 901.312.8818 mobile: 901.490.5325 http://www.coroutine.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 -~----------~----~----~----~------~----~------~--~---
I agree with Tim on this. I am working on a new feature in one of my applications that entails calling a long running process. I wrote the application to do it synchronously at first to make sure everything was working. Then I installed/setup delayed_job, modified my controller to call @myobject.send_later :my_method and my call was now asynchronous. Total time to convert from synchronous to asynchronous: < 15 minutes. On Sep 24, 3:02 pm, Tim Lowrimore <tlowrim...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Seriously, checkout delayed_job. It''s super easy to implement, and is > anything but overkill. Here''s the URL for the project:http://github.com/collectiveidea/delayed_job > > ... and as an added bonus, Ryan Bates covers it in a Railscast. Here''s the > URL for the Railscast: > > http://railscasts.com/episodes/171-delayed-job > > Cheers, > Tim > > > > On Thu, Sep 24, 2009 at 4:27 PM, nextpulse <rob...-pZCIFDiVgMdl57MIdRCFDg@public.gmane.org> wrote: > > > Any one know if it is possible to do a non-blocking http request > > within Ror? > > > I looked at Net::HTTP, nothing obvious. > > > In my code, I want to fire off a http request (and not care about the > > return or wait for it) and continue with the rest of the work. > > I know I can use backgroundrb etc - but that seems an overkill. > > > Any help appreciated. > > > thanks. > > -- > Tim Lowrimore > Coroutine LLC > 516 Tennessee St., Suite 215 > Memphis, TN 38103 > office: 901.312.8818 > mobile: 901.490.5325http://www.coroutine.com
Thanks for the info. delayed_job is a great piece but its just an overkill for what i wanted. I wanted something simple - not just from an implementation standpoint - but resource too (not add any extra load etc). "Keep in mind that each worker will check the database at least every 5 seconds." For those who are interested, a solution was to use ruby system (''...&''). I fire it off (and forget) and let the OS mange it. (If needed, you can also manage the queues via ruby Process) On Sep 24, 3:40 pm, "E. Litwin" <elit...-ur4TIblo6goN+BqQ9rBEUg@public.gmane.org> wrote:> I agree with Tim on this. > > I am working on a new feature in one of my applications that entails > calling a long running process. > I wrote the application to do it synchronously at first to make sure > everything was working. > > Then I installed/setup delayed_job, modified my controller to call > @myobject.send_later :my_method and my call was now asynchronous. > > Total time to convert from synchronous to asynchronous: < 15 minutes. > > On Sep 24, 3:02 pm, Tim Lowrimore <tlowrim...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Seriously, checkout delayed_job. It''s super easy to implement, and is > > anything but overkill. Here''s the URL for the project:http://github.com/collectiveidea/delayed_job > > > ... and as an added bonus, Ryan Bates covers it in a Railscast. Here''s the > > URL for the Railscast: > > >http://railscasts.com/episodes/171-delayed-job > > > Cheers, > > Tim > > > On Thu, Sep 24, 2009 at 4:27 PM, nextpulse <rob...-pZCIFDiVgMdl57MIdRCFDg@public.gmane.org> wrote: > > > > Any one know if it is possible to do a non-blocking http request > > > within Ror? > > > > I looked at Net::HTTP, nothing obvious. > > > > In my code, I want to fire off a http request (and not care about the > > > return or wait for it) and continue with the rest of the work. > > > I know I can use backgroundrb etc - but that seems an overkill. > > > > Any help appreciated. > > > > thanks. > > > -- > > Tim Lowrimore > > Coroutine LLC > > 516 Tennessee St., Suite 215 > > Memphis, TN 38103 > > office: 901.312.8818 > > mobile: 901.490.5325http://www.coroutine.com