WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#29779 closed enhancement (fixed)

Update Heartbeat to use the "page visibility" API and add a setting for minimal interval

Reported by: azaozz Owned by: azaozz
Milestone: 4.1 Priority: normal
Severity: normal Version:
Component: Administration Keywords: has-patch
Focuses: Cc:

Description

Most browsers now support the new Page Visibility API. It has the advantage of working across iframes (window focus/blur fires when focusing an iframe).

By adding a setting for "minimal interval", the user will be able to limit the number of AJAX requests. Frequent requests can be a problem on some hosts and cause the user to exceed the allocated server CPU time or other resources.

Attachments (1)

29779.patch (9.0 KB) - added by azaozz 4 years ago.

Download all attachments as: .zip

Change History (3)

@azaozz
4 years ago

#1 @azaozz
4 years ago

  • Keywords has-patch added

In 29779.patch:

  • Switch Heartbeat from using window.focus/blur to using the page visibility API.
  • Add a setting for minimal interval. Maximum value is 10 min. Once set at initialization, this cannot be changed.
  • Extend the setting of interval to support 120 sec. (60 sec, is still the default).
  • Always suspend after one hour of inactivity. This will also remove the post lock. If the user returns after the post lock has been removed and somebody has taken over the post editing, the user will see the "Taken over..." modal as soon as there is some mouse or keyboard activity.

#2 @azaozz
4 years ago

  • Owner set to azaozz
  • Resolution set to fixed
  • Status changed from new to closed

In 30293:

Heartbeat:

  • Use the page visibility API (when available) and document.hasFocus() instead of window.onfocus/onblur. Improves speeding up/slowing down the interval and works for iframes by default.
  • Add a setting for minimal interval. Maximum value is 10 min. This overrides all other intervals and cannot be changed after setting it at initialization. Can be used to reduce the frequency of requests on hosts that have low limits for used CPU time, etc.
  • Extend the setting of interval to support 120 sec. (60 sec, is still the default).
  • Always suspend after one hour of keyboard/mouse/touch inactivity.

Fixes #29779.

Note: See TracTickets for help on using tickets.