* Previously, each job type had to be configured to allow delayed jobs
Change-Id: I5f3cf04deca76d6684aa6b14eea97a8673a7f5af
$this->compression = isset( $params['compression'] ) ? $params['compression'] : 'none';
$this->redisPool = RedisConnectionPool::singleton( $params['redisConfig'] );
$this->daemonized = !empty( $params['daemonized'] );
$this->compression = isset( $params['compression'] ) ? $params['compression'] : 'none';
$this->redisPool = RedisConnectionPool::singleton( $params['redisConfig'] );
$this->daemonized = !empty( $params['daemonized'] );
+ $this->checkDelay = true; // always enabled
}
protected function supportedOrders() {
}
protected function supportedOrders() {
* @throws JobQueueError
*/
protected function doGetDelayedCount() {
* @throws JobQueueError
*/
protected function doGetDelayedCount() {
- if ( !$this->checkDelay ) {
- return 0; // no delayed jobs
- }
$conn = $this->getConnection();
try {
return $conn->zSize( $this->getQueueKey( 'z-delayed' ) );
$conn = $this->getConnection();
try {
return $conn->zSize( $this->getQueueKey( 'z-delayed' ) );
// Push ready delayed jobs into the queue every 10 jobs to spread the load.
// This is also done as a periodic task, but we don't want too much done at once.
// Push ready delayed jobs into the queue every 10 jobs to spread the load.
// This is also done as a periodic task, but we don't want too much done at once.
- if ( !$this->daemonized && $this->checkDelay && mt_rand( 0, 9 ) == 0 ) {
+ if ( !$this->daemonized && mt_rand( 0, 9 ) == 0 ) {
$this->recyclePruneAndUndelayJobs();
}
$this->recyclePruneAndUndelayJobs();
}
if ( $this->daemonized ) {
return array(); // managed in the runner loop
}
if ( $this->daemonized ) {
return array(); // managed in the runner loop
}
- $periods = array( 3600 ); // standard cleanup (useful on config change)
+ $periods = array( 300 ); // 5 min; delayed/stale jobs
if ( $this->claimTTL > 0 ) {
$periods[] = ceil( $this->claimTTL / 2 ); // halved to avoid bad timing
}
if ( $this->claimTTL > 0 ) {
$periods[] = ceil( $this->claimTTL / 2 ); // halved to avoid bad timing
}
- if ( $this->checkDelay ) {
- $periods[] = 300; // 5 minutes
- }
$period = min( $periods );
$period = max( $period, 30 ); // sanity
$period = min( $periods );
$period = max( $period, 30 ); // sanity