[wp-trac] [WordPress Trac] #23216: Create "WP Heartbeat" API

WordPress Trac noreply at wordpress.org
Tue Jan 29 18:10:35 UTC 2013


#23216: Create "WP Heartbeat" API
----------------------------+------------------
 Reporter:  azaozz          |       Owner:
     Type:  task (blessed)  |      Status:  new
 Priority:  normal          |   Milestone:  3.6
Component:  Administration  |     Version:
 Severity:  normal          |  Resolution:
 Keywords:  autosave-redo   |
----------------------------+------------------

Comment (by azaozz):

 Replying to [comment:36 ocean90]:

 Currently the last one to set the interval wins. This implements the idea
 to be able to speed up or slow down the "beat" when needed ([#comment:21
 comment:21]). `wp.heartbeat.interval()` gets the current interval and
 `wp.heartbeat.interval(5)` sets it. So a plugin can do:

 {{{
 if ( wp.heartbeat.interval() > 10 )
     wp.heartbeat.interval(10);
 }}}

 The default interval can also be set when initializing with the
 `'heartbeat_settings'` filter in PHP.

 Been thinking how to best implement this speed up/slow down. Seems the
 most common case would be to speed up when we expect certain response from
 the server, like while taking over a post lock: we need to notify user B
 and unlock the post for editing as soon as possible after user A releases
 the lock.

 In that terms `wp.heartbeat.interval()` should probably accept two int
 arguments, first is the interval in seconds, second would be for how many
 "beats" (optional, default 10?). Then we can protect a lower value for the
 interval so plugins don't stomp each other.

 Another possibility is to have three values: fast(5), normal(15),
 slow(30). Then setting it to `slow` will only be possible if the current
 value is `normal`, and setting `fast` will look into the second argument:
 for how long/how many "beats", and will revert to `normal` after that.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/23216#comment:38>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list