App seems to get stuck, helper not listening anymore?

I have a simple trivia game (I say simple) because the UI is simple I suppose. But It’s multi-player.

I use helpers and Session variables to allow users to answer at different times.

If you answer before the last person answers, I take you to a ‘Waiting…’ screen until the last person in the game answers.

If I just let it run, it generally works, but I’ve instituted a short setTimeout for 3 seconds so I can show you the right answer after you’ve selected an answer. I then take you to the waiting screen if you aren’t the last person to answer.

I then use a simple counter of how many users joined the game, and how many answers there are on a given question to know when to move everyone to the next question. Again, I’m using a query on a specific value in the db to know to set a Session variable that tells the game to move forward for each user.

Sometimes though, it seems like the game moves forward, then quickly jumps you to the ‘Waiting…’ screen without letting you answer…and it never goes back.

Now, again, setting the game to ‘live’ is done through a query of a specific db field value, which I see is set properly to show a question, and a Session variable that is set based on the db value.

To be more brief and clear, sometimes it seems like the helper stops listening / looking at the db for a value, and one user is stuck on the ‘waiting…’ screen. I find that if you click the back button on the browser, then forward it fixes itself, but I’m not sure if there is something I’m missing, or a way to make sure the helper keeps listening and updates the values properly.

Here’s my code for querying and changing the session variable. Note that in waiting mode, the Session is set to ‘waiting’.

Template.activeQuestion.helpers({
    questionStatus: function() {
        var continueGame = Games.find({ gameCode: gameCode, active: "Yes" }).fetch();
        var statusNow = continueGame[0].nextQuestionStatus;
        console.log("-----    Status is currently: " + statusNow + "    -----");
        if (statusNow == "live") {
             Session.set("questionStatus", "live");
             return Session.get("questionStatus");
        } else if (statusNow == "complete") {
            FlowRouter.go("/finalScoreCard");
        } else {
            return Session.get("questionStatus");
        }
    },
});

Where I console log the statusNow, I see waiting several times over, then nothing, but if I look in the database at the field, I see ‘live’ is set.

Any help is greatly appreciated.

Ok, I figured out it’s not getting stuck, but that for some reason my function that checks how many players have answered is getting called again with no click event. The click event is the only event that calls that function in the entire program, so I just don’t know.

It also seems to be a bit of a timing thing with the setTimeout I’m using.

I’m not sure why it’s happening, but trying to dig in. So, now I see it in the ‘waiting’ status, and mitigated it slightly be setting a check

set session to live
}```

This seems to help some, but if the game gets that triggered click when another player has already answered, you still get stuck, so I'm not sure how to figure out what's triggering that call into the function that sets the session status to waiting.  I see