You are here

protected function SolrConnectorPluginBase::useTimeout in Search API Solr 4.x

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

Set the timeout.

Parameters

string $timeout: (optional) The configured timeout to use. Default is self::QUERY_TIMEOUT.

\Solarium\Core\Client\Endpoint|null $endpoint: (optional) The Solarium endpoint object.

Return value

mixed

22 calls to SolrConnectorPluginBase::useTimeout()
SolrConnectorPluginBase::autocomplete in src/SolrConnector/SolrConnectorPluginBase.php
Executes a search query and returns the raw response.
SolrConnectorPluginBase::coreRestGet in src/SolrConnector/SolrConnectorPluginBase.php
Sends a REST GET request to the Solr core and returns the result.
SolrConnectorPluginBase::coreRestPost in src/SolrConnector/SolrConnectorPluginBase.php
Sends a REST POST request to the Solr core and returns the result.
SolrConnectorPluginBase::extract in src/SolrConnector/SolrConnectorPluginBase.php
Executes an extract query.
SolrConnectorPluginBase::getCoreInfo in src/SolrConnector/SolrConnectorPluginBase.php
Gets information about the Solr Core.

... See full list

File

src/SolrConnector/SolrConnectorPluginBase.php, line 1088

Class

SolrConnectorPluginBase
Defines a base class for Solr connector plugins.

Namespace

Drupal\search_api_solr\SolrConnector

Code

protected function useTimeout(string $timeout = self::QUERY_TIMEOUT, ?Endpoint $endpoint = NULL) {
  $this
    ->connect();
  if (!$endpoint) {
    $endpoint = $this->solr
      ->getEndpoint();
  }
  $seconds = $endpoint
    ->getOption($timeout);
  if ($seconds) {
    $adapter = $this->solr
      ->getAdapter();
    if ($adapter instanceof TimeoutAwareInterface) {
      $adapter
        ->setTimeout($seconds);
    }
    else {
      $this
        ->getLogger()
        ->warning('The function SolrConnectorPluginBase::useTimeout() has no effect because you use a HTTP adapter that is not implementing TimeoutAwareInterface. You need to adjust your SolrConnector accordingly.');
    }
  }
}