You are here

public function SolrConnectorPluginBase::adjustTimeout in Search API Solr 8.2

Same name and namespace in other branches
  1. 8.3 src/SolrConnector/SolrConnectorPluginBase.php \Drupal\search_api_solr\SolrConnector\SolrConnectorPluginBase::adjustTimeout()
  2. 4.x src/SolrConnector/SolrConnectorPluginBase.php \Drupal\search_api_solr\SolrConnector\SolrConnectorPluginBase::adjustTimeout()

Sets a new timeout for queries, but not for indexing or optimization.

The timeout will not be saved in the configuration of the connector. It will be overwritten for the current request only.

Parameters

int $timeout:

\Solarium\Core\Client\Endpoint|NULL $endpoint:

Return value

int The previous timeout value.

Overrides SolrConnectorInterface::adjustTimeout

File

src/SolrConnector/SolrConnectorPluginBase.php, line 913

Class

SolrConnectorPluginBase
Defines a base class for Solr connector plugins.

Namespace

Drupal\search_api_solr\SolrConnector

Code

public function adjustTimeout(int $timeout, Endpoint $endpoint = NULL) {
  $this
    ->connect();
  if (!$endpoint) {
    $endpoint = $this->solr
      ->getEndpoint('core');
  }
  $previous_timeout = $this
    ->getTimeout($endpoint);
  $endpoint
    ->setTimeout($timeout);
  return $previous_timeout;
}