jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/326464 )

Change subject: Use CirrusSearchClientSideSearchTimeout for connection timeout
......................................................................


Use CirrusSearchClientSideSearchTimeout for connection timeout

Bug: T152895
Change-Id: Ie9298f78804d98330298c2df2136118a7d5454d5
---
M includes/Searcher.php
1 file changed, 19 insertions(+), 3 deletions(-)

Approvals:
  Cindy-the-browser-test-bot: Looks good to me, but someone else must approve
  EBernhardson: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/Searcher.php b/includes/Searcher.php
index ec9ebe6..c47631b 100644
--- a/includes/Searcher.php
+++ b/includes/Searcher.php
@@ -398,7 +398,7 @@
                                                'docIds' => $docIds,
                                        ] );
                                        // Shard timeout not supported on get 
requests so we just use the client side timeout
-                                       $this->connection->setTimeout( 
$this->getTimeout() );
+                                       $this->connection->setTimeout( 
$this->getClientTimeout() );
                                        // We use a search query instead of 
_get/_mget, these methods are
                                        // theorically well suited for this 
kind of job but they are not
                                        // supported on aliases with multiple 
indices (content/general)
@@ -442,7 +442,7 @@
                                                'timeout' => 
$this->getTimeout(),
                                        ];
 
-                                       $this->connection->setTimeout( 
$queryOptions['timeout'] );
+                                       $this->connection->setTimeout( 
$this->getClientTimeout() );
                                        $pageType = 
$this->connection->getNamespaceType( $this->indexBaseName );
                                        $match = new \Elastica\Query\Match();
                                        $match->setField( 'name', $name );
@@ -647,7 +647,7 @@
                $search = new MultiSearch( $this->connection->getClient() );
                $search->addSearches( $searches );
 
-               $this->connection->setTimeout( $this->getTimeout() );
+               $this->connection->setTimeout( $this->getClientTimeout() );
 
                if ( $this->config->get( 'CirrusSearchMoreAccurateScoringMode' 
) ) {
                        $search->setSearchType( 
\Elastica\Search::OPTION_SEARCH_TYPE_DFS_QUERY_THEN_FETCH );
@@ -908,6 +908,9 @@
                return 'CirrusSearch-Search';
        }
 
+       /**
+        * @return string search retrieval timeout
+        */
        private function getTimeout() {
                if ( $this->searchContext->getSearchType() === 'regex' ) {
                        $type = 'regex';
@@ -919,6 +922,19 @@
        }
 
        /**
+        * @return int the client side timeout
+        */
+       private function getClientTimeout() {
+               if ( $this->searchContext->getSearchType() === 'regex' ) {
+                       $type = 'regex';
+               } else {
+                       $type = 'default';
+               }
+
+               return $this->config->getElement( 
'CirrusSearchClientSideSearchTimeout', $type );
+       }
+
+       /**
         * Some queries, like more like this, are quite expensive and can cause
         * latency spikes. This allows redirecting queries using particular
         * features to specific clusters.

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie9298f78804d98330298c2df2136118a7d5454d5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: DCausse <dcau...@wikimedia.org>
Gerrit-Reviewer: Cindy-the-browser-test-bot <bernhardsone...@gmail.com>
Gerrit-Reviewer: EBernhardson <ebernhard...@wikimedia.org>
Gerrit-Reviewer: Gehel <gleder...@wikimedia.org>
Gerrit-Reviewer: Smalyshev <smalys...@wikimedia.org>
Gerrit-Reviewer: Tjones <tjo...@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