Hi all,
I am having a problem where when I call periodically_call_remote the CPU usage goes really high and I have to kill the browser to return the system to normal. I have the following remote call:
<%= periodically_call_remote :url => {:action => '_live_now' }, :update => 'live_now_list', :frequency => 10 %>
This works fine, at the start. After about 20/30 seconds the CPU starts rising, to 20%, 50%, 70% and higher.
At first I have the above remote call in a partial (_live_now.rhtml):
<div id="live_now_list">
... stuff...
</div>
<%= periodically_call_remote :url => {:action => '_live_now' }, :update => 'live_now_list', :frequency => 10 %>
/But/ I did notice that when I moved the periodically_call_remote call to the index.rhtml which contains the partial _live_now.rhtml, the problem does not happen. When I moved it to index.rhtml the CPU stays low and the call works fine every 10 seconds.
It's great that it works but I would like to understand as to why moving the remote call to index.rhtml fixes the problem?
Any insights would be greatly appreciated.
Cheers, Diego