Weired problem with periodically_call_remote

Can any one tell me why i get such large number of POST messages to
the WEBBRICK…

It is crashing my WINDOWS within 5 minutes.

I am trying to make a portlet that will periodically refresh the stock
quotes. The quotes are arranged in atable and pulled from mysql
database .

I have a controller(mainpage_controller.rb)

def index
@ticker_pages, @tickers = paginate :nsecurrent, :per_page => 20
end

=============
my view layout(mainpage.rhtml)

TEST APPLICATION

<%= stylesheet_link_tag “list”, :media => “all” %>
<%= javascript_include_tag :defaults %>

<%= @content_for_layout %> ================= my view ( index.rhtml) <%= render :partial => "ticker_box",:layout => false %> ==================== my partial (_ticker_box.rhtml)

<%= periodically_call_remote( :update => “myinfobox”,:frequency =>
60,:url => { :action => “index” } ) %>

Ticker Listing at <%= Time.now %>

<%
odd_or_even = 0
for product in @tickers
odd_or_even = 1 - odd_or_even
%>

<% end %>
TICKER OPEN HIGH LOW CURRENT
<%= h(product.symbol.slice(0,product.symbol.length-3)) %> <%= product.open %> <%= product.high %> <%= product.low %> <%= product.current_val %>
===================

+++++++++++++++++++++++++++++++++++++++++++++++++

The strange webbrick log sequence

i started at 11:56:52

at 11:57:54 i got the first POST

at 11:58:54 & 11:58:55 I got 2 POST <<<<<<<<<<<<< WHY???

at 11:59:54 , 11:59:55,11:59:55,11:59:55 i got 4 POST
<<<<<<<<<<<<<WHY???

the log

127.0.0.1 - - [05/Feb/2007:11:56:52 India Standard Time] “GET /
mainpage/ HTTP/1.1” 200 5892

  • -> /mainpage/
    127.0.0.1 - - [05/Feb/2007:11:57:54 India Standard Time] “POST /
    mainpage HTTP/1.1” 200 5892
  • -> /mainpage
    127.0.0.1 - - [05/Feb/2007:11:58:54 India Standard Time] “POST /
    mainpage HTTP/1.1” 200 5892
  • -> /mainpage
    127.0.0.1 - - [05/Feb/2007:11:58:55 India Standard Time] “POST /
    mainpage HTTP/1.1” 200 5892
  • -> /mainpage
    127.0.0.1 - - [05/Feb/2007:11:59:54 India Standard Time] “POST /
    mainpage HTTP/1.1” 200 5892
  • -> /mainpage
    127.0.0.1 - - [05/Feb/2007:11:59:55 India Standard Time] “POST /
    mainpage HTTP/1.1” 200 5892
  • -> /mainpage
    127.0.0.1 - - [05/Feb/2007:11:59:55 India Standard Time] “POST /
    mainpage HTTP/1.1” 200 5892
  • -> /mainpage
    127.0.0.1 - - [05/Feb/2007:11:59:55 India Standard Time] “POST /
    mainpage HTTP/1.1” 200 5892
  • -> /mainpage
    127.0.0.1 - - [05/Feb/2007:12:00:54 India Standard Time] “POST /
    mainpage HTTP/1.1” 200 5892
  • -> /mainpage
    127.0.0.1 - - [05/Feb/2007:12:00:55 India Standard Time] “POST /
    mainpage HTTP/1.1” 200 5892
  • -> /mainpage
    127.0.0.1 - - [05/Feb/2007:12:00:55 India Standard Time] “POST /
    mainpage HTTP/1.1” 200 5892
  • -> /mainpage
    127.0.0.1 - - [05/Feb/2007:12:00:55 India Standard Time] “POST /
    mainpage HTTP/1.1” 200 5892
  • -> /mainpage
    127.0.0.1 - - [05/Feb/2007:12:00:55 India Standard Time] “POST /
    mainpage HTTP/1.1” 200 5892
  • -> /mainpage
    127.0.0.1 - - [05/Feb/2007:12:00:56 India Standard Time] “POST /
    mainpage HTTP/1.1” 200 5892
  • -> /mainpage
    127.0.0.1 - - [05/Feb/2007:12:00:56 India Standard Time] “POST /
    mainpage HTTP/1.1” 200 5892
  • -> /mainpage
    127.0.0.1 - - [05/Feb/2007:12:00:56 India Standard Time] “POST /
    mainpage HTTP/1.1” 200 5892
  • -> /mainpage

=================

Regards

On 2/4/07, BENI [email protected] wrote:

Can any one tell me why i get such large number of POST messages to
the WEBBRICK…

i started at 11:56:52
at 11:57:54 i got the first POST
at 11:58:54 & 11:58:55 I got 2 POST <<<<<<<<<<<<< WHY???
at 11:59:54 , 11:59:55,11:59:55,11:59:55 i got 4 POST
<<<<<<<<<<<<<WHY???

As a programmer, upon seeing a doubling behaviour like this, you
should immediately have alarm bells going off in your head that scream
‘recursion!’ Before even looking at your code, you should be able to
tell what the problem is based on the behaviour, but let’s take a look
at the code anyway (snipped to show the relevant lines):

my view ( index.rhtml)
<%= render :partial => “ticker_box”,:layout => false %>

my partial (_ticker_box.rhtml)
<%= periodically_call_remote( :update => “myinfobox”,:frequency =>
60,:url => { :action => “index” } ) %>

index.rhtml is including a partial which updates part of the page with
index, which includes a partial, which updates part of its page with
index… Can you see where this is going? :slight_smile: This is known as mutual
recursion.

It is crashing my WINDOWS within 5 minutes.

Do you mean your browser windows? After 5 minutes, it should still
only be around 2^4 requests – if this is crashing Windows, you
probably have other issues with your OS.

HTH,

J.

Thanks I could get rid of the issue by putting the
periodically_call_remote in the index.rhtml .

Regards

r