Make WordPress Core

Opened 6 years ago

Last modified 5 years ago

#44795 new defect (bug)

WordPress Heartbeat Interval stuck on 15 secs

Reported by: nicksws's profile Nicksws Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.9.8
Component: General Keywords:
Focuses: Cc:

Description

Hi!

I think I've found a bug with the WordPress Heartbeat API, in short, on some installs ( Only some ) I am unable to alter the interval.

On some of our installs ( we manage 200+ ) we are finding admin-ajax.php hitting our servers pretty hard and on occasion will cause a 503 error.

To try and resolve this ourselves, we have tried:

As you can see, we've made significant effort to try and resolve this problem on our own without any luck.

Function causing the issue

Locating where this is coming from, I've tracked it to the heartbeat.js file.
The function is interval on line 612 of the non minified version.

If I alter the same function in heartbeat.min.js ( Altering 15e3 to 60e3 ), the interval will now be set to 60 and admin-ajax.php requests drop dramatically.

With all the effort I've put in to fix this and failing, I can only assume this is a bug of some kind.

Other info

  • This is not every website we have, on different hosting platforms.
  • Some websites are completely fine, others are not.
  • Doesn't seem to make a difference which browser ( Firefox and Chrome tested ).
  • All websites are updated often with the latest core version.

Expected Result

We expected to be able to adjust to heartbeat interval to a slower rate.

Hopefully this covers everything needed, please let me know if not!

Thanks
Steven

Change History (3)

#1 @daleharrison
5 years ago

I was just about to open a ticket about this myself as I recently noticed the same issue on several sites I maintain. I'm using WordPress 4.9.10 across the board as my organization has not made the jump to WordPress 5 yet. I ended up finding this ticket so I thought I'd chime in here.

Strangely enough, while I've overridden the interval to run every 60 seconds, my tests have shown that on a single site installation, WordPress is making requests to admin-ajax.php every 45 seconds, and on a multisite network, it is doing so every 15 seconds.

There's definitely something going on here but I can't quite seem to pinpoint what it is. The information in the Codex (https://codex.wordpress.org/Function_Reference/wp_heartbeat_settings#Example) which I followed does not seem to be correct or may be outdated.

@Nicksws have you had any breakthroughs with this or is it still an issue for you?

#2 @Nicksws
5 years ago

Hi @daleharrison,

We've haven't really been having problems with this recently which is lucky, I think the hosting company we use has made some changes to help.

Checking an install I am working on, its not trashing admin-ajax.php requests anymore but the interval still seems to be stuck on 15 ( On post-new.php ):

data[wp-refresh-post-lock][post_id] 826
interval 15
_nonce 354e100954
action heartbeat
screen_id post
has_focus true

In my case i've used a plugin to alter this and its still posting at 15 sec intervals so I would say this is still an issue.

After attempting to use code and several plugins to alter this interval with no luck, I can't say its the plugin developers issue - I think the issue is more WordPress side somewhere.

Hope this helps,
Steven

#3 @daleharrison
5 years ago

Hi @Nicksws,

Thanks for the additional information and for letting me know you're still experiencing the issue. Fingers crossed that this ticket will get some traction as I'd appreciate some input from the core committers. With a number of WordPress sites (including one large multisite network) running on the same server, the amount of requests is creating a slight performance bottleneck for us.

I also wonder if this is something that has been resolved somewhere along the line in WordPress 5.0+. Perhaps when I have time I will investigate that.

My organization will be upgrading our servers fairly soon and I'm curious to see if our new hosting environment has any effect on this. I'll update the ticket if I find anything new.

Cheers,
Dale

Note: See TracTickets for help on using tickets.