From: Aaron Schulz Date: Wed, 16 Jul 2014 00:43:29 +0000 (-0700) Subject: Added "daemonized" flag to JobQueueRedis X-Git-Tag: 1.31.0-rc.0~14917^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/password.php?a=commitdiff_plain;h=e11da363d0c051aef295bd966bd3b5bc9a9390ad;p=lhc%2Fweb%2Fwiklou.git Added "daemonized" flag to JobQueueRedis Change-Id: I6df1004a7872809bfd28ad1477b9504e76f75a92 --- diff --git a/includes/jobqueue/JobQueueRedis.php b/includes/jobqueue/JobQueueRedis.php index 088f447cd7..522bae12a7 100644 --- a/includes/jobqueue/JobQueueRedis.php +++ b/includes/jobqueue/JobQueueRedis.php @@ -62,9 +62,10 @@ class JobQueueRedis extends JobQueue { /** @var string Server address */ protected $server; - /** @var string Compression method to use */ protected $compression; + /** @var bool */ + protected $daemonized; const MAX_AGE_PRUNE = 604800; // integer; seconds a job can live once claimed (7 days) @@ -79,6 +80,9 @@ class JobQueueRedis extends JobQueue { * If a hostname is specified but no port, the standard port number * 6379 will be used. Required. * - compression : The type of compression to use; one of (none,gzip). + * - daemonized : Set to true if the redisJobRunnerService runs in the background. + * This will disable job recycling/undelaying from the MediaWiki side + * to avoid redundance and out-of-sync configuration. * @param array $params */ public function __construct( array $params ) { @@ -87,6 +91,7 @@ class JobQueueRedis extends JobQueue { $this->server = $params['redisServer']; $this->compression = isset( $params['compression'] ) ? $params['compression'] : 'none'; $this->redisPool = RedisConnectionPool::singleton( $params['redisConfig'] ); + $this->daemonized = !empty( $params['daemonized'] ); } protected function supportedOrders() { @@ -716,6 +721,9 @@ LUA; * @return array */ protected function doGetPeriodicTasks() { + if ( $this->daemonized ) { + return array(); // managed in the runner loop + } $periods = array( 3600 ); // standard cleanup (useful on config change) if ( $this->claimTTL > 0 ) { $periods[] = ceil( $this->claimTTL / 2 ); // avoid bad timing