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

Change subject: Make setting port number in statsd config optional
......................................................................


Make setting port number in statsd config optional

The current code did not actually verify if the host given was
a valid host at all - it just expected a port, and complained
about it not being a valid host otherwise. Replace with simpler
code that uses default statsd port if none is specified.

Bug: T88094
Change-Id: Ib11071e5097926146e4017eacffa771ab2f84c4c
---
M redisJobRunnerService
1 file changed, 7 insertions(+), 5 deletions(-)

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



diff --git a/redisJobRunnerService b/redisJobRunnerService
index d6906d8..35c708a 100755
--- a/redisJobRunnerService
+++ b/redisJobRunnerService
@@ -188,12 +188,14 @@
                }
 
                if ( isset( $config['statsd'] ) ) {
-                       $m = array();
-                       if ( preg_match( '/^(.+):(\d+)$/', $config['statsd'], 
$m ) ) {
-                               $this->statsdHost = $m[1];
-                               $this->statsdPort = (int)$m[2];
+                       if ( strpos( $config['statsd'], ':' ) !== false ) {
+                               $parts = explode( ':', $config['statsd'] );
+                               $this->statsdHost = $parts[0];
+                               $this->statsdPort = (int)$parts[1];
                        } else {
-                               throw new Exception( "Invalid profiler address 
'{$config['statsd']}'." );
+                               // Use default statsd port if not specified
+                               $this->statsdHost = $config['statsd'];
+                               $this->statsdPort = 8125;
                        }
                }
        }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib11071e5097926146e4017eacffa771ab2f84c4c
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/services/jobrunner
Gerrit-Branch: master
Gerrit-Owner: Yuvipanda <yuvipa...@gmail.com>
Gerrit-Reviewer: Aaron Schulz <asch...@wikimedia.org>
Gerrit-Reviewer: Legoktm <legoktm.wikipe...@gmail.com>
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