X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fjobqueue%2FJobQueueRedis.php;h=759662df907c0259b7f36a10b6c23791720f2fb9;hb=0441c8194107fb48f056a8732d2f2c64cc0232e5;hp=c2c9d66119910afc3f4bf433818e0b908aff9c63;hpb=cbac334f116c6546c422a67ce99d2a56eb792d30;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/jobqueue/JobQueueRedis.php b/includes/jobqueue/JobQueueRedis.php index c2c9d66119..759662df90 100644 --- a/includes/jobqueue/JobQueueRedis.php +++ b/includes/jobqueue/JobQueueRedis.php @@ -18,7 +18,6 @@ * http://www.gnu.org/copyleft/gpl.html * * @file - * @author Aaron Schulz */ use Psr\Log\LoggerInterface; @@ -75,6 +74,8 @@ class JobQueueRedis extends JobQueue { /** @var string Compression method to use */ protected $compression; + const MAX_PUSH_SIZE = 25; // avoid tying up the server + /** * @param array $params Possible keys: * - redisConfig : An array of parameters to RedisConnectionPool::__construct(). @@ -131,7 +132,7 @@ class JobQueueRedis extends JobQueue { protected function doGetSize() { $conn = $this->getConnection(); try { - return $conn->lSize( $this->getQueueKey( 'l-unclaimed' ) ); + return $conn->lLen( $this->getQueueKey( 'l-unclaimed' ) ); } catch ( RedisException $e ) { $this->throwRedisException( $conn, $e ); } @@ -212,7 +213,7 @@ class JobQueueRedis extends JobQueue { if ( $flags & self::QOS_ATOMIC ) { $batches = [ $items ]; // all or nothing } else { - $batches = array_chunk( $items, 100 ); // avoid tying up the server + $batches = array_chunk( $items, self::MAX_PUSH_SIZE ); } $failed = 0; $pushed = 0; @@ -501,7 +502,7 @@ LUA; $keys[] = $this->getQueueKey( $prop ); } - $ok = ( $conn->delete( $keys ) !== false ); + $ok = ( $conn->del( $keys ) !== false ); $conn->sRem( $this->getGlobalKey( 's-queuesWithJobs' ), $this->encodeQueueName() ); return $ok; @@ -606,7 +607,7 @@ LUA; try { $conn->multi( Redis::PIPELINE ); foreach ( $types as $type ) { - $conn->lSize( $this->getQueueKey( 'l-unclaimed', $type ) ); + $conn->lLen( $this->getQueueKey( 'l-unclaimed', $type ) ); } $res = $conn->exec(); if ( is_array( $res ) ) {