DCausse has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/392001 )

Change subject: Don't try to report update metrics if the response is not valid
......................................................................

Don't try to report update metrics if the response is not valid

Seen in logs where a null $responseSet is being sent to reportUpdateMetrics.
The only case where it could happen is when we detect documentMissing
exceptions.

Bug: T180298
Change-Id: I6ca58270e2ab001fab02275636a237449c528fc8
(cherry picked from commit 81a99cd1478997d3b9764165511b14e9d4a13dff)
---
M includes/DataSender.php
1 file changed, 4 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CirrusSearch 
refs/changes/01/392001/1

diff --git a/includes/DataSender.php b/includes/DataSender.php
index a539d5f..ac63484 100644
--- a/includes/DataSender.php
+++ b/includes/DataSender.php
@@ -207,10 +207,13 @@
                        $exception = $e;
                }
 
+               // TODO: rewrite error handling, the logic here is hard to 
follow
                $validResponse = $responseSet !== null && count( 
$responseSet->getBulkResponses() ) > 0;
                if ( $exception === null && ( $justDocumentMissing || 
$validResponse ) ) {
                        $this->success();
-                       $this->reportUpdateMetrics( $responseSet, $indexType, 
count( $data ) );
+                       if ( $validResponse ) {
+                               $this->reportUpdateMetrics( $responseSet, 
$indexType, count( $data ) );
+                       }
                        return Status::newGood();
                } else {
                        $this->failure( $exception );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6ca58270e2ab001fab02275636a237449c528fc8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: REL1_30
Gerrit-Owner: DCausse <dcau...@wikimedia.org>

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

Reply via email to