Walter Lee Davis
2007-Apr-08 02:49 UTC
Updater and PeriodicUpdater fighting with one another
I have a long-running process to build a directory tree in a database from a very large and deep folder structure. I am using sessions for security, but the process takes so long that it never finishes. Having tried and failed to override the session time-out, I am trying to work around the problem by having a PeriodicUpdater tickle the session by loading a page every minute. But I am also using Updater to submit the admin form. I call the PeriodicUpdater first, then the Updater to submit the form. Both fire, and the PeriodicUpdater completes its first pass and waits. Then it fires again, and never finishes. I can watch it spin in Firebug, and it doesn''t stop or return a second time until the Updater does. Here''s how I have it set now: var updateForm = $(''files_update''); if(updateForm){ updateForm.onsubmit = function(){ Element.show(''spinner''); if($(''progress'')) new Ajax.PeriodicalUpdater(''progress'', ''progress.php'', {asynchronous:true, frequency:30}); new Ajax.Updater(''results'', ''rebuild.php'', { asynchronous:true, parameters:Form.serialize(this), onComplete:function(){ Element.hide(''spinner''); } }); return false; } } Any suggestions? Thanks, Walter --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Walter Lee Davis wrote:> I have a long-running process to build a directory tree in a database > from a very large and deep folder structure. I am using sessions for > security, but the process takes so long that it never finishes.How could you slice the process up into steps, and let a simple PeriodicUpdater send a tickle to the process to execute its next step? Your alternative solution is to install the latest BackgrounDBr, or the equivalent, server-side, so you don''t hang the server up. -- Phlip http://flea.sourceforge.net/PiglegToo_1.html --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Fabian Lange
2007-Apr-08 08:50 UTC
Re: Updater and PeriodicUpdater fighting with one another
Hi, As the page is titled progress.php, I assume that your serverside for both actions is php? And I assume further that you use session autostart? Then you are a bit in trouble because php is bad at what you want :) One request blocks all other "threads" accessing the same session. This can, to my knowledge, only be solved by the long running part calling: http://de.php.net/session_write_close to indicate: I am done with the session anybody else can work on it. That works for me in 95% of the cases. In the rest 5% it despite that gets stuck and I haven''t found a 100% solution .: Fabian --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Walter Lee Davis
2007-Apr-08 14:25 UTC
Re: Updater and PeriodicUpdater fighting with one another
GENIUS! This worked perfectly. No, I was manually starting my sessions, but I didn''t know about the blocking behavior. This now works perfectly. Walter On Apr 8, 2007, at 4:50 AM, Fabian Lange wrote:> > Hi, > As the page is titled progress.php, I assume that your serverside for > both > actions is php? And I assume further that you use session autostart? > Then you are a bit in trouble because php is bad at what you want :) > One request blocks all other "threads" accessing the same session. > This can, to my knowledge, only be solved by the long running part > calling: > http://de.php.net/session_write_close > to indicate: I am done with the session anybody else can work on it. > > That works for me in 95% of the cases. In the rest 5% it despite that > gets > stuck and I haven''t found a 100% solution > > .: Fabian > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---