$n = 0;
$group = JobQueueGroup::singleton();
+ // Handle any required periodic queue maintenance
+ $count = $group->executeReadyPeriodicTasks();
+ if ( $count > 0 ) {
+ $this->runJobsLog( "Executed $count periodic queue task(s)." );
+ }
+
do {
$job = ( $type === false )
? $group->pop( JobQueueGroup::TYPE_DEFAULT, JobQueueGroup::USE_CACHE )
$t = microtime( true );
$this->runJobsLog( $job->toString() . " STARTING" );
$status = $job->run();
- $group->ack( $job ); // done
+ if ( $status ) {
+ $group->ack( $job ); // done
+ }
$t = microtime( true ) - $t;
$timeMs = intval( $t * 1000 );
if ( !$status ) {
break;
}
// Don't let any slaves/backups fall behind...
- $group->get( $type )->waitForBackups();
+ $group->get( $job->getType() )->waitForBackups();
}
} while ( $job ); // stop when there are no jobs
}