X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=blobdiff_plain;f=maintenance%2FnextJobDB.php;h=219b5d8e573a821678548bf308a10663d1f3ebdc;hb=a7a84e45c011ad74d2c79394786e8d7e71a6fb34;hp=f5bf4da2874e59429c9fe3ad9e4158efdded5503;hpb=2ca0d60987f4019992daab9baadd94bed9ee8212;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/nextJobDB.php b/maintenance/nextJobDB.php index f5bf4da287..219b5d8e57 100644 --- a/maintenance/nextJobDB.php +++ b/maintenance/nextJobDB.php @@ -21,7 +21,7 @@ * @ingroup Maintenance */ -require_once( __DIR__ . '/Maintenance.php' ); +require_once __DIR__ . '/Maintenance.php'; /** * Maintenance script that picks a database that has pending jobs. @@ -77,10 +77,9 @@ class nextJobDB extends Maintenance { return; // no jobs for this type } - list( $type, $db ) = $candidates[ mt_rand( 0, count( $candidates ) - 1 ) ]; - if ( !$this->checkJob( $type, $db ) ) { // queue is actually empty? - $pendingDBs[$type] = array_diff( $pendingDBs[$type], $db ); - JobQueueAggregator::singleton()->notifyQueueEmpty( $db, $type ); + list( $type, $db ) = $candidates[mt_rand( 0, count( $candidates ) - 1 )]; + if ( JobQueueGroup::singleton( $db )->isQueueDeprioritized( $type ) ) { + $pendingDBs[$type] = array_diff( $pendingDBs[$type], array( $db ) ); $again = true; } } while ( $again ); @@ -92,17 +91,6 @@ class nextJobDB extends Maintenance { } } - /** - * Check if the specified database has a job of the specified type in it. - * The type may be false to indicate "all". - * @param $type string - * @param $dbName string - * @return bool - */ - private function checkJob( $type, $dbName ) { - return !JobQueueGroup::singleton( $dbName )->get( $type )->isEmpty(); - } - /** * Do all ready periodic jobs for all databases every 5 minutes (and .1% of the time) * @return integer @@ -128,4 +116,4 @@ class nextJobDB extends Maintenance { } $maintClass = "nextJobDb"; -require_once( RUN_MAINTENANCE_IF_MAIN ); +require_once RUN_MAINTENANCE_IF_MAIN;