Hi, I''ve got a method that requires me to sleep for a couple of seconds. The problem is that all other requests are help up, waiting for this to finish. Is there a way to block just this request without impacting other requests? I tried Thread.start() { sleep 10 @myobject.reload } render :xml => @myobject.to_xml Which makes it not block, but then the user can''t see the results of the reload. I''m looking at some packages like this, but I''m not sure if this is the right approach. http://backgroundrb.rubyforge.org/ -- 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 -~----------~----~----~----~------~----~------~--~---
brabuhr-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Jan-24 17:50 UTC
Re: Sleep blocking other users.
On 1/24/07, David Harkness <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hi, I''ve got a method that requires me to sleep for a couple of seconds. > > The problem is that all other requests are help up, waiting for this to > finish. > > Is there a way to block just this request without impacting other > requests?Two suggestions: a) Multiple Rails processes behind a load-balancing reverse proxy. b) Run the blocking task in the background and provide a way for the browser to refresh status (for example, timed refresh of status div via javascript): http://www.yup.com/articles/2006/05/23/ handling-rails-background-and-batch-jobs-with-backgrounddrb http://backgroundrb.rubyforge.org/ --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Though viewable from a browser, it''s not intended as such. It sounds like I''ll have to stick to something I was hoping to avoid. Return a unique ID in the XML that''s returned from the GET request And provide a second address to check for status changes. Eventually I''ll be using a load-balancing proxy, perhaps that might be the way to go. unknown wrote:> On 1/24/07, David Harkness <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: >> Hi, I''ve got a method that requires me to sleep for a couple of seconds. >> >> The problem is that all other requests are help up, waiting for this to >> finish. >> >> Is there a way to block just this request without impacting other >> requests? > > Two suggestions: > > a) Multiple Rails processes behind a load-balancing reverse proxy. > > b) Run the blocking task in the background and provide a way for the > browser to refresh status (for example, timed refresh of status div via > javascript): > > http://www.yup.com/articles/2006/05/23/ > handling-rails-background-and-batch-jobs-with-backgrounddrb > http://backgroundrb.rubyforge.org/-- 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 -~----------~----~----~----~------~----~------~--~---