function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Raghav Sharma 39Raghav Sharma 39 

Timeout attribute not working in action polar

Ajax call is not stopping by itself . The counter still keeps on incrementing. Can someone please let me know what am I doing wrong here?

VF page code:
<apex:page controller="polarExampleClass">
    <apex:form >
        <apex:outputText value="Watch this counter: {!count}" id="counter"/>
        <apex:actionPoller action="{!incrementCounter}" reRender="counter" interval="5" timeout="10000"/>
    </apex:form>
</apex:page>

Apex class code:
public class polarExampleClass {
Integer count = 0;
            
    public PageReference incrementCounter() {
        count++;
        return null;
    }
            
    public Integer getCount() {
        return count;
    }
}
Best Answer chosen by Raghav Sharma 39
sagar jogisagar jogi
timeout doesn't mean that exit of execution logic. Please see this link (https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_actionPoller.htm)

Even if you put timeout = '1000' then still it will increment counter.

Timeout is something that about AJAX request timeout for every single call. if execution will not finish in given timeframe then it will be timeout.

All Answers

Alex SelwynAlex Selwyn
ActionPoller does not stop. TimeOut parameter indicates the update request times out if the server didn't respond in 10000ms.

https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_actionPoller.htm

Thanks,
Alex.
sagar jogisagar jogi
timeout doesn't mean that exit of execution logic. Please see this link (https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_actionPoller.htm)

Even if you put timeout = '1000' then still it will increment counter.

Timeout is something that about AJAX request timeout for every single call. if execution will not finish in given timeframe then it will be timeout.
This was selected as the best answer