* the socket once it's done.
*/
protected function triggerJobs() {
- global $wgJobRunRate, $wgServer;
+ global $wgJobRunRate, $wgServer, $wgRunJobsAsync;
if ( $wgJobRunRate <= 0 || wfReadOnly() ) {
return;
$n = intval( $wgJobRunRate );
}
+ if ( !$wgRunJobsAsync ) {
+ // If running jobs asynchronously has been disabled, run the job here
+ // while the user waits
+ SpecialRunJobs::executeJobs( $n );
+ return;
+ }
+
+ if ( !JobQueueGroup::singleton()->queuesHaveJobs( JobQueueGroup::TYPE_DEFAULT ) ) {
+ return; // do not send request if there are probably no jobs
+ }
+
$query = array( 'title' => 'Special:RunJobs',
'tasks' => 'jobs', 'maxjobs' => $n, 'sigexpiry' => time() + 5 );
$query['signature'] = SpecialRunJobs::getQuerySignature( $query );