jenkins-bot has submitted this change and it was merged.

Change subject: Cleanups based on IDE warnings
......................................................................


Cleanups based on IDE warnings

* Use InvalidArgumentException
* Make use of $pruned variable

Change-Id: Ib509903ea75744d01d139c93903e2f1cd648d4ca
---
M redisJobChronService
M src/RedisJobService.php
2 files changed, 10 insertions(+), 7 deletions(-)

Approvals:
  Gilles: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/redisJobChronService b/redisJobChronService
index 98bd08d..40b3c63 100755
--- a/redisJobChronService
+++ b/redisJobChronService
@@ -314,6 +314,7 @@
                                $this->incrStats( "job-recycle.$qType", 
$released );
                                $this->incrStats( "job-abandon.$qType", 
$abandoned );
                                $this->incrStats( "job-undelay.$qType", 
$undelayed );
+                               $this->incrStats( "job-prune.$qType", $pruned );
                        }
                } catch ( RedisException $e ) {
                        $failed += count( $paramsByQueue );
diff --git a/src/RedisJobService.php b/src/RedisJobService.php
index 5423da1..bea9c87 100755
--- a/src/RedisJobService.php
+++ b/src/RedisJobService.php
@@ -81,14 +81,14 @@
                $file = $args['config-file'];
                $content = file_get_contents( $file );
                if ( $content === false ) {
-                       throw new Exception( "Coudn't open configuration file 
'{$file}''" );
+                       throw new InvalidArgumentException( "Coudn't open 
configuration file '{$file}''" );
                }
 
                // Remove comments and load into an array
                $content = trim( preg_replace( '/\/\/.*$/m', '',  $content ) );
                $config = json_decode( $content, true );
                if ( !is_array( $config ) ) {
-                       throw new Exception( "Could not parse JSON file 
'{$file}'." );
+                       throw new InvalidArgumentException( "Could not parse 
JSON file '{$file}'." );
                }
 
                $instance = new static( $config );
@@ -103,20 +103,21 @@
        protected function __construct( array $config ) {
                $this->aggrSrvs = $config['redis']['aggregators'];
                if ( !count( $this->aggrSrvs ) ) {
-                       throw new Exception( "Empty list for 
'redis.aggregators'." );
+                       throw new InvalidArgumentException( "Empty list for 
'redis.aggregators'." );
                }
                $this->queueSrvs = $config['redis']['queues'];
                if ( !count( $this->queueSrvs ) ) {
-                       throw new Exception( "Empty list for 'redis.queues'." );
+                       throw new InvalidArgumentException( "Empty list for 
'redis.queues'." );
                }
                $this->dispatcher = $config['dispatcher'];
                if ( !$this->dispatcher ) {
-                       throw new Exception( "No command provided for 
'dispatcher'." );
+                       throw new InvalidArgumentException( "No command 
provided for 'dispatcher'." );
                }
 
                foreach ( $config['groups'] as $name => $group ) {
                        if ( !is_int( $group['runners'] ) ) {
-                               throw new Exception( "Invalid 'runners' value 
for runner group '$name'." );
+                               throw new InvalidArgumentException(
+                                       "Invalid 'runners' value for runner 
group '$name'." );
                        } elseif ( $group['runners'] == 0 ) {
                                continue; // loop disabled
                        }
@@ -125,7 +126,8 @@
                                if ( !isset( $group[$k] ) ) {
                                        $group[$k] = array();
                                } elseif ( !is_array( $group[$k] ) ) {
-                                       throw new Exception( "Invalid '$k' 
value for runner group '$name'." );
+                                       throw new InvalidArgumentException(
+                                               "Invalid '$k' value for runner 
group '$name'." );
                                }
                        }
                        $this->loopMap[] = $group;

-- 
To view, visit https://gerrit.wikimedia.org/r/226895
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib509903ea75744d01d139c93903e2f1cd648d4ca
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/jobrunner
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <asch...@wikimedia.org>
Gerrit-Reviewer: Gilles <gdu...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to