purgeList.php: Swap usleep() to sleep()

sleep is sleeping for seconds, while usleep sleeps for microseconds.
But the value is multiply by 1e6, which makes it real seconds.
The option is also documented to take seconds and not fraction of
seconds.

Change-Id: I507fa549729456a05ba45e9b3ee2e0bf04c49d14
This commit is contained in:
Umherirrender 2022-03-09 00:17:44 +01:00 committed by Ammarpad
parent ed547a5be5
commit 31bfc71c37

View file

@ -37,7 +37,7 @@ class PurgeList extends Maintenance {
private $allNamespaces;
/** @var bool */
private $doDbTouch;
/** @var float */
/** @var int */
private $delay;
public function __construct() {
@ -58,7 +58,7 @@ class PurgeList extends Maintenance {
$this->namespaceId = $this->getOption( 'namespace' );
$this->allNamespaces = $this->hasOption( 'all-namespaces' );
$this->doDbTouch = $this->hasOption( 'db-touch' );
$this->delay = floatval( $this->getOption( 'delay', '0' ) );
$this->delay = intval( $this->getOption( 'delay', '0' ) );
$conf = $this->getConfig();
if ( ( $this->namespaceId !== null || $this->allNamespaces )
@ -163,7 +163,7 @@ class PurgeList extends Maintenance {
$this->output( $url . "\n" );
}
$hcu->purgeUrls( $url, $hcu::PURGE_NAIVE );
usleep( $this->delay * 1e6 );
sleep( $this->delay );
}
} else {
if ( $this->hasOption( 'verbose' ) ) {