X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=blobdiff_plain;f=includes%2Fjobqueue%2FJobQueueRedis.php;h=7dad014e45151c70d81b961c59ddae28932f476e;hb=4f31afd21b208965bae734396f6e2c6df06684c7;hp=25a271ca14ec913b8db82871c690c8c8787b38bd;hpb=3ba9b09378c94f8ce4075a5c95f2c1e2a4db8750;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/jobqueue/JobQueueRedis.php b/includes/jobqueue/JobQueueRedis.php index 25a271ca14..7dad014e45 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(). @@ -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; @@ -793,9 +794,9 @@ LUA; private function getGlobalKey( $name ) { $parts = [ 'global', 'jobqueue', $name ]; foreach ( $parts as $part ) { - if ( !preg_match( '/[a-zA-Z0-9_-]+/', $part ) ) { - throw new InvalidArgumentException( "Key part characters are out of range." ); - } + if ( !preg_match( '/[a-zA-Z0-9_-]+/', $part ) ) { + throw new InvalidArgumentException( "Key part characters are out of range." ); + } } return implode( ':', $parts );