Ruby on Rails Tuesday, March 29, 2011

Thanks for your advices

My parsing operation is updating the db about each second
I do not really understand what you mean by "your parsing operation
can be
broken into multiple, shorter requests",
but in the current implementation is the parsing operation broken into
steps and each step is performed each time the corresponding
controller method is called from the periodically remote Ajax function

Yes, I can do "something lightweight like get a count etc" I am doing
it now and storing the result in the database

Although this approach works for the parsing I do not think it is the
way to go for all processes that needs a progress indicator.
It seems to complicated for just beeing able to inform the user about
progress. I am looking for a simplier method
How is this problem solved bythe rails community? What is best
practice ?

On Mar 29, 3:05 pm, Walter Lee Davis <wa...@wdstudio.com> wrote:
> On Mar 29, 2011, at 7:17 AM, Hans wrote:
>
>
>
> > Sorry but there were too many typos Here is a corrected verion
>
> > I need a progress indicator that shows the progress of a parser that
> > also writes the progress state to a db. I have several other examples
> > of the need
> > of  informing the users of progress of processes that takes some time.
>
> > I will not put the parser in a background process, as I think there
> > should be a more simple solution, considering all the code that needs
> > a background process for this solution to work i my situation with
> > many progress indicators
>
> > Could one use a remote ajax call to start the e.g the parser and then
> > call an Ajax function
> > at the onBefore call back, that asks the server about the progress as
> > defined in the db
>
> This should work, although you're possibly going to hit some problems  
> with server time-out on that initial request. All browsers will give  
> you 2 request threads at a time, some will give you more than that. So  
> you'd be filling your pipe with the one long-running one and the  
> second intermittent "polling" call. If your parsing operation can be  
> broken into multiple, shorter requests, then that would be the avenue  
> I would pursue first. Otherwise, you stand to hit some very difficult-
> to-diagnose problems going down this route.
>
> As far as how to gauge progress, what sort of data are you storing,  
> and can you do something lightweight like get a count of the number of  
> rows when you start, estimate how many rows you will add, and then do  
> a quick count at each status update request?
>
> Walter
>
>
>
> > Is this a possible approach?
> > If so what Ajax function should be used to ask the server db about
> > progress?
> > Are there other better solutions?
>
> > --
> > 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@googlegroups.com.
> > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com
> > .
> > For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en
> > .
>
>

--
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@googlegroups.com.
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.

No comments:

Post a Comment