1
votes

I have a problem with p:poll

The thing is im using it all over my code, and it works fine. So the problem probably comes from somewhere else.. but i cant figure out where..

In this particular place, p:poll stops working after 50 seconds. I can't find either a solution or a similar answer.

    <h:form>
        <h:panelGroup id="check_sitting">

            <h:panelGroup rendered="#{!(commonBean.idAnonymous eq null || commonBean.idAnonymous eq '') and !commonBean.hasShownLoginModal}">

                <script>                
                    $("#modalWelcome").modal("show");
                </script>
            </h:panelGroup>
        </h:panelGroup>
        <p:poll interval="1" listener="#{commonBean.listenpol}" update="check_sitting"  />
    </h:form>

The "listenpol" method is a test i am doing to check what is happening. But it's not helping..

    public void listenpol(){
        System.out.println("listenpol " + DateTime.now());
    }

What happens: it refreshes correctly for about 50 seconds. After that, it stops.

Thanks in advance And sorry if its a dumb question. i just dont get it

EDIT:

im posting more code. I deleted the script. Right now it looks like this:

<h:body>
<div class="row">
    <div class="col-sm-3 col-lg-3">
        <div class="dash-unit">

            <ui:insert name="header">
                <ui:include src="/template/common/commonHeader.xhtml" />
            </ui:insert>

            <ui:insert id="contentInsert" name="content">
                <ui:include src="/template/common/commonContent.xhtml"/>
            </ui:insert>

            <ui:insert name="footer">
                <ui:include src="/template/common/commonFooter.xhtml" />
            </ui:insert>

        </div>
    </div>
</div>
<h:form>
    <h:panelGroup id="check_sitting">

    </h:panelGroup>
    <p:poll interval="1" listener="#{commonBean.listenpol}" update="check_sitting"  />
</h:form>

I repeat the problem: it printis out what the method says each second (note that this is the final behaviour im hoping to implement, its just a test) but it completely stops after 52 seconds... I really cant figure it out.

I also wanted to add: im using a few other p:poll around my code. maybe this is causing trouble??

Thanks again

1
Did you try to remove the code inside h:panelGroup? Maybe script causes an error and therefore the p:poll stops? - Manuel
i just tried that. but it didnt work.. but thank you!! i also tried to delete the other stuff inside it, but its still stopping exactly 52 seconds after it starts.. its really weird. im starting to think it has something to do with the session?? - onzinsky
Check your session timeout, maybe its 1 minute? But I don't think so. Try to reduce your problem down (speaking of lines of code) ... until the problem does not exist anymore, and there you have the problem causer. Or you could post more code, because I can't see the error within the code you've provided - Manuel
ok! im editing the question to put some more code - onzinsky

1 Answers

1
votes

I just got it. After this code i posted there was some modal that has its own p:poll. In it, the interval is 60 seconds. For some reason the 60 seconds p:poll is stopping the first one. Now i'll need to figure out how to implement both somehow.. but i think ill be able to do it on my own! thanks

this is the code:

<h:body>
<div class="row">
    <div class="col-sm-3 col-lg-3">
        <div class="dash-unit">

            <ui:insert name="header">
                <ui:include src="/template/common/commonHeader.xhtml" />
            </ui:insert>

            <ui:insert id="contentInsert" name="content">
                <ui:include src="/template/common/commonContent.xhtml"/>
            </ui:insert>

            <ui:insert name="footer">
                <ui:include src="/template/common/commonFooter.xhtml" />
            </ui:insert>

        </div>
    </div>
</div>
<h:form>
    <h:panelGroup id="check_sitting">

    </h:panelGroup>
    <p:poll interval="1" listener="#{commonBean.listenpol}" update="check_sitting"  />
</h:form>

<!-- this is the modal i deleted -->
<ui:insert name="modalNotRegistered">
    <ui:include src="/template/common/modals/modalNotRegistered.xhtml"/>
</ui:insert>