<?php
/**
- * Degenerate job that just replaces itself in the queue.
+ * Degenerate job that does nothing.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*/
/**
- * Degenerate job that just replace itself in the queue.
- * Useful for lock contention and performance testing.
+ * Degenerate job that does nothing, but can optionally replace itself
+ * in the queue and/or sleep for a brief time period. These can be used
+ * to represent "no-op" jobs or test lock contention and performance.
*
* @ingroup JobQueue
*/
if ( !isset( $this->params['usleep'] ) ) {
$this->params['usleep'] = 0;
}
+ $this->removeDuplicates = !empty( $this->params['removeDuplicates'] );
}
public function run() {
$params = $this->params;
$params['lives']--;
$job = new self( $this->title, $params );
- $job->insert();
+ JobQueueGroup::singleton()->push( $job );
}
return true;
}