Make WordPress Core

Changeset 53226

Timestamp:
04/20/2022 05:53:25 AM (2 years ago)
Author:
peterwilsoncc
Message:

Autosave: Compare heartbeat intervals in same unit.

Move the conversion of minimalInterval to milliseconds to be grouped with the other time conversions from seconds to milliseconds.

This fixes a bug in which the minimal and main intervals were compared after the former had been converted to milliseconds but the latter had not. This could cause the heatbeat interval to blow out to unexpectedly high values if the minimal interval was set.

Props tabrisrp, sabernhardt, SergeyBiryukov, audrasjb.
Fixes #54825.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/js/_enqueues/wp/heartbeat.js

    r50547 r53226  
    156156                if ( options.minimalInterval ) {
    157157                    options.minimalInterval = parseInt( options.minimalInterval, 10 );
    158                     settings.minimalInterval = options.minimalInterval > 0 && options.minimalInterval <= 600 ? options.minimalInterval * 1000 : 0;
     158                    settings.minimalInterval = options.minimalInterval > 0 && options.minimalInterval <= 600 ? options.minimalInterval : 0;
    159159                }
    160160
     
    177177            settings.mainInterval = settings.mainInterval * 1000;
    178178            settings.originalInterval = settings.mainInterval;
     179
     180
     181
    179182
    180183            /*
Note: See TracChangeset for help on using the changeset viewer.