* @file
* @author Aaron Schulz
*/
+use Psr\Log\LoggerInterface;
/**
* Class to handle job queues stored in Redis
class JobQueueRedis extends JobQueue {
/** @var RedisConnectionPool */
protected $redisPool;
+ /** @var LoggerInterface */
+ protected $logger;
/** @var string Server address */
protected $server;
/** @var string Compression method to use */
protected $compression;
- const MAX_AGE_PRUNE = 604800; // integer; seconds a job can live once claimed (7 days)
-
- /** @var string Key to prefix the queue keys with (used for testing) */
- protected $key;
-
/**
* @param array $params Possible keys:
* - redisConfig : An array of parameters to RedisConnectionPool::__construct().
"Non-daemonized mode is no longer supported. Please install the " .
"mediawiki/services/jobrunner service and update \$wgJobTypeConf as needed." );
}
+ $this->logger = \MediaWiki\Logger\LoggerFactory::getInstance( 'redis' );
}
protected function supportedOrders() {
$args[] = (string)$this->serialize( $item );
}
static $script =
+ /** @lang Lua */
<<<LUA
local kUnclaimed, kSha1ById, kIdBySha1, kDelayed, kData, kQwJobs = unpack(KEYS)
-- First argument is the queue ID
*/
protected function popAndAcquireBlob( RedisConnRef $conn ) {
static $script =
+ /** @lang Lua */
<<<LUA
local kUnclaimed, kSha1ById, kIdBySha1, kClaimed, kAttempts, kData = unpack(KEYS)
local rTime = unpack(ARGV)
$conn = $this->getConnection();
try {
static $script =
+ /** @lang Lua */
<<<LUA
local kClaimed, kAttempts, kData = unpack(KEYS)
local id = unpack(ARGV)
* @throws JobQueueConnectionError
*/
protected function getConnection() {
- $conn = $this->redisPool->getConnection( $this->server );
+ $conn = $this->redisPool->getConnection( $this->server, $this->logger );
if ( !$conn ) {
throw new JobQueueConnectionError(
"Unable to connect to redis server {$this->server}." );