DCausse has uploaded a new change for review. ( 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(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CirrusSearch refs/changes/64/326464/1 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: newchange Gerrit-Change-Id: Ie9298f78804d98330298c2df2136118a7d5454d5 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/CirrusSearch Gerrit-Branch: master Gerrit-Owner: DCausse <dcau...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits