Fixed some comments and removed redundant constant.
authorAaron Schulz <aschulz@wikimedia.org>
Fri, 8 Feb 2013 18:09:41 +0000 (10:09 -0800)
committerAaron Schulz <aschulz@wikimedia.org>
Mon, 11 Feb 2013 18:11:52 +0000 (10:11 -0800)
* Also normalized params in RedisConnectionPool to avoid fragmentation.

Change-Id: I803dae52262b974836817d2091725f044faf7022

includes/clientpool/RedisConnectionPool.php
includes/job/JobQueueRedis.php

index 95a0afa..eace85a 100644 (file)
@@ -28,7 +28,7 @@
  * This can be used to get handle wrappers that free the handle when the wrapper
  * leaves scope. The maximum number of free handles (connections) is configurable.
  * This provides an easy way to cache connection handles that may also have state,
- * such as handle does between multi() and exec(), and without hoarding connections.
+ * such as handle does between multi() and exec(), and without hoarding connections.
  * The wrappers use PHP magic methods so that calling functions on them calls the
  * function of the actual Redis object handle.
  *
@@ -98,6 +98,7 @@ class RedisConnectionPool {
         * @return RedisConnectionPool
         */
        public static function singleton( array $options ) {
+               ksort( $options ); // normalize
                $id = sha1( serialize( $options ) );
                if ( !isset( self::$instances[$id] ) ) {
                        self::$instances[$id] = new self( $options );
index 6c908a2..3e7a47c 100644 (file)
@@ -35,7 +35,6 @@ class JobQueueRedis extends JobQueue {
 
        const ROOTJOB_TTL   = 1209600; // integer; seconds to remember root jobs (14 days)
        const MAX_AGE_PRUNE = 604800; // integer; seconds a job can live once claimed (7 days)
-       const MAX_ATTEMPTS  = 3; // integer; number of times to try a job
 
        /**
         * @params include:
@@ -137,7 +136,7 @@ class JobQueueRedis extends JobQueue {
 
                $conn = $this->getConnection();
                try {
-                       // Find which of these jobs are duplicates unclaimed jobs in the queue...
+                       // Find which of these jobs are duplicates of unclaimed jobs in the queue...
                        if ( count( $dedupUids ) ) {
                                $conn->multi( Redis::PIPELINE );
                                foreach ( $dedupUids as $uid ) { // check if job data exists