Ori.livneh has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/204093

Change subject: Don't bother buffering a counter update with a delta of zero.
......................................................................

Don't bother buffering a counter update with a delta of zero.

Counter updates with a delta of zero don't do anything, so there's no point in
sending them over the wire.

Change-Id: Iae82ee9c9a8544c94abfcbdf944bd713687dce9d
---
M includes/libs/BufferingStatsdDataFactory.php
1 file changed, 5 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/93/204093/1

diff --git a/includes/libs/BufferingStatsdDataFactory.php 
b/includes/libs/BufferingStatsdDataFactory.php
index ea5b09d..f942077 100644
--- a/includes/libs/BufferingStatsdDataFactory.php
+++ b/includes/libs/BufferingStatsdDataFactory.php
@@ -39,7 +39,7 @@
        }
 
        public function produceStatsdData( $key, $value = 1, $metric = 
self::STATSD_METRIC_COUNT ) {
-               $this->buffer[] = $entity = $this->produceStatsdDataEntity();
+               $entity = $this->produceStatsdDataEntity();
                if ( $key !== null ) {
                        $prefixedKey = ltrim( $this->prefix . '.' . $key, '.' );
                        $entity->setKey( $prefixedKey );
@@ -50,6 +50,10 @@
                if ( $metric !== null ) {
                        $entity->setMetric( $metric );
                }
+               // Don't bother buffering a counter update with a delta of zero.
+               if ( !( $metric === self::STATSD_METRIC_COUNT && $value === 0 ) 
) {
+                       $this->buffer[] = $entity;
+               }
                return $entity;
        }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iae82ee9c9a8544c94abfcbdf944bd713687dce9d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Ori.livneh <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to