How to enforce widget update intervals (especially minimum)


I am trying for a long time to make the live widget “listen to me” :slight_smile: I managed that only partial. The thing is i want the widget to refresh at a constant rate, because several other thing i customized depend on this.

With the setting in config ini, and from within live.js i managed to enforce the maximum update interval to 12 seconds. Problem is with latest update 2.16.2 the behavior is like this:

  • nobody on site, the widget updates at 12 seconds, every time, i tested this for as long as 20 minutes in the night.

  • but if there is a new page view, then the widget updates after just 3 seconds, then after another 4 seconds, then after another 6 seconds, something like that, until it reaches again 12 seconds interval where it “freezes” until the next time there is a page view…

This is an unnecessary cascade of quick refreshes which not only are broking several things to my install but also convinced my ISP to mail me about reaching a limit with requests (i am on shared host)… if one is having constant page-views, then the widget refreshes very, very, very often…

I have a setting of minimum interval of 10000 in live.js from within the plugin folder, but this is utterly ignored.

Also, i thought that this is having something to do with heartbeat (and maybe incremental beats) but i removed it completely from the tracking code and it makes no difference.

Any other idea of how can i convince the live widget to wait for A MINIMUM of x seconds before updating, regardless if there is or not a new pageview?

Thank you

It sounds like you are experiencing a bug in the live real time widgets. Could you maybe post a screenshot showing the irregularity of real time updates? AFAIK the widget should update regularly depending on the value of these config.ini.php settings

; by default, the real time Live! widget will update every 5 seconds and refresh with new visits/actions/etc.
; you can change the timeout so the widget refreshes more often, or not as frequently
live_widget_refresh_after_seconds = 5

; by default, the Live! real time visitor count widget will check to see how many visitors your
; website received in the last 3 minutes. changing this value will change the number of minutes
; the widget looks in.
live_widget_visitor_count_last_minutes = 3

I did manage to do a work-around for my problems caused by rapid refreshes by using a localstorage and comparing values, but i am happy to help. The problems with my ISP are not solved anyway :slight_smile:

So, i recorded this real-timevideo, screenshots wont help i believe

In the beginning you can see that there is no “activity” on the tracked site, and the refreshes are exactly 15 seconds apart. But then a wild-pageview appears, and the refreshes goes wild, first 3 seconds, then 5, then at 9 etc… after a while when the site has no activity it crawls back to the 15-seconds.

This recording is done when the heartbeat was active (the red-green colors are related to when the user was last active), but as i said, I tested with heartbeat disabled and it was the same behavior.

Also, this maybe-bug is 100 % related to the latest version, because prior to upgrade it was not present while everything in my end was the same (plugins, settings, etc)

Let me know if I can be of any other help.