Rick Fiorentino wrote:> Hi All,
>
> I have a table in a view (its a partial) that is updated from every 5
> seconds as the shortest frequency to as long as manual by the user based
> on some configuration parameters.
>
> With the periodically_call_remote it appears as though I am getting
> subsequent calls going out even though I have one or more pending?
> Although the call is asynchronous I thought calls went out only when the
> completion of previous calls occurs. Meaning, even if my interval might
> have been exceeded it won''t send out the next request until the
previous
> comes in. This seems an issue as the load on the server increases the
> probability of missing the interval window increases as well.
>
> Is this not true? If not, how does one manage avoiding parallel calls?
> Would I be better off to dynamically create a single periodic call per
> generation of the partial that is updated as a result of the AJAX call?
>
> Also, if I have a pending call and the user moves to a different page
> before the response comes in I get prototype errors in the firebug
> console. None of them cause crashes etc, but I thought this would be
> benign?
>
> Any information is appreciated on any of these points.
>
> Best Regards,
> Rick
First of all, why are your ajax requests taking longer than 5 seconds?
Second, asynchronous means that javascript and user interaction will
continue to take place while the request is being fetched. When the
timer clicks off again, the new request has no way of knowing the status
of the old request.a
Third, you can specify a :condition in the options hash, which is a
javascript expression that must return true in order to send the
request. So I imagine that you could do something like this:
<% periodically_call_remote(
:url => { :action => ''foo'' },
:condition => "!waitingForFoo",
:loading => ''waitingForFoo = true'',
:complete => ''waitingForFoo = false''
)
%>
This should only send the request if you are not waiting for one.
--
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
-~----------~----~----~----~------~----~------~--~---