X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fjob%2FJobQueueFederated.php;h=35b80ca6a73739410cfae308da30d77c136e8c22;hb=a71728c990496101c740a33efa0b238d9fc2417d;hp=19de8bb529eb723912d3156fdec23c2816abf754;hpb=af94bc9c69db033c7308192b42a47a4f27e25878;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/job/JobQueueFederated.php b/includes/job/JobQueueFederated.php index 19de8bb529..35b80ca6a7 100644 --- a/includes/job/JobQueueFederated.php +++ b/includes/job/JobQueueFederated.php @@ -138,9 +138,13 @@ class JobQueueFederated extends JobQueue { } foreach ( $this->partitionQueues as $queue ) { - if ( !$queue->doIsEmpty() ) { - $this->cache->add( $key, 'false', self::CACHE_TTL_LONG ); - return false; + try { + if ( !$queue->doIsEmpty() ) { + $this->cache->add( $key, 'false', self::CACHE_TTL_LONG ); + return false; + } + } catch ( JobQueueError $e ) { + wfDebugLog( 'exception', $e->getLogMessage() ); } } @@ -179,7 +183,11 @@ class JobQueueFederated extends JobQueue { $count = 0; foreach ( $this->partitionQueues as $queue ) { - $count += $queue->$method(); + try { + $count += $queue->$method(); + } catch ( JobQueueError $e ) { + wfDebugLog( 'exception', $e->getLogMessage() ); + } } $this->cache->set( $key, $count, self::CACHE_TTL_SHORT ); @@ -244,7 +252,13 @@ class JobQueueFederated extends JobQueue { // Insert the de-duplicated jobs into the queues... foreach ( $uJobsByPartition as $partition => $jobBatch ) { $queue = $this->partitionQueues[$partition]; - if ( $queue->doBatchPush( $jobBatch, $flags ) ) { + try { + $ok = $queue->doBatchPush( $jobBatch, $flags ); + } catch ( JobQueueError $e ) { + $ok = false; + wfDebugLog( 'exception', $e->getLogMessage() ); + } + if ( $ok ) { $key = $this->getCacheKey( 'empty' ); $this->cache->set( $key, 'false', JobQueueDB::CACHE_TTL_LONG ); } else { @@ -259,7 +273,13 @@ class JobQueueFederated extends JobQueue { $jobsLeft = array_merge( $jobsLeft, $jobBatch ); // not inserted } else { $queue = $this->partitionQueues[$partition]; - if ( $queue->doBatchPush( $jobBatch, $flags ) ) { + try { + $ok = $queue->doBatchPush( $jobBatch, $flags ); + } catch ( JobQueueError $e ) { + $ok = false; + wfDebugLog( 'exception', $e->getLogMessage() ); + } + if ( $ok ) { $key = $this->getCacheKey( 'empty' ); $this->cache->set( $key, 'false', JobQueueDB::CACHE_TTL_LONG ); } else { @@ -288,7 +308,12 @@ class JobQueueFederated extends JobQueue { break; // all partitions at 0 weight } $queue = $this->partitionQueues[$partition]; - $job = $queue->pop(); + try { + $job = $queue->pop(); + } catch ( JobQueueError $e ) { + $job = false; + wfDebugLog( 'exception', $e->getLogMessage() ); + } if ( $job ) { $job->metadata['QueuePartition'] = $partition; return $job; @@ -336,13 +361,21 @@ class JobQueueFederated extends JobQueue { protected function doDelete() { foreach ( $this->partitionQueues as $queue ) { - $queue->doDelete(); + try { + $queue->doDelete(); + } catch ( JobQueueError $e ) { + wfDebugLog( 'exception', $e->getLogMessage() ); + } } } protected function doWaitForBackups() { foreach ( $this->partitionQueues as $queue ) { - $queue->waitForBackups(); + try { + $queue->waitForBackups(); + } catch ( JobQueueError $e ) { + wfDebugLog( 'exception', $e->getLogMessage() ); + } } }