From 0a6de1fe7a0491572134ccae6780884632eea96d Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Thu, 15 Nov 2012 00:49:48 -0800 Subject: [PATCH] [JobQueue] Fixed de-listing updates to pending job cache. Change-Id: Ied0f2962fcbcde62a041592933c667c861f54715 --- maintenance/nextJobDB.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/maintenance/nextJobDB.php b/maintenance/nextJobDB.php index 875b93d5b4..d8480f3774 100644 --- a/maintenance/nextJobDB.php +++ b/maintenance/nextJobDB.php @@ -81,17 +81,19 @@ class nextJobDB extends Maintenance { $candidates = array_values( $candidates ); $db = $candidates[ mt_rand( 0, count( $candidates ) - 1 ) ]; if ( !$this->checkJob( $type, $db ) ) { - // This job is not available in the current database. Remove it from - // the cache. if ( $type === false ) { + // There are no jobs available in the current database foreach ( $pendingDBs as $type2 => $dbs ) { $pendingDBs[$type2] = array_diff( $pendingDBs[$type2], array( $db ) ); } } else { + // There are no jobs of this type available in the current database $pendingDBs[$type] = array_diff( $pendingDBs[$type], array( $db ) ); } - - $wgMemc->set( $memcKey, $pendingDBs, 300 ); + // Update the cache to remove the outdated information + $pendingDbInfo['pendingDBs'] = $pendingDBs; + // @TODO: fix race condition with these updates + $wgMemc->set( $memcKey, $pendingDbInfo ); $again = true; } } while ( $again ); -- 2.20.1