You are here

public function SolrConnectorPluginBase::useTimeout in Search API Solr 8

Same name and namespace in other branches
  1. 8.3 src/SolrConnector/SolrConnectorPluginBase.php \Drupal\search_api_solr\SolrConnector\SolrConnectorPluginBase::useTimeout()
  2. 4.x src/SolrConnector/SolrConnectorPluginBase.php \Drupal\search_api_solr\SolrConnector\SolrConnectorPluginBase::useTimeout()
13 calls to SolrConnectorPluginBase::useTimeout()
SolrConnectorPluginBase::autocomplete in src/SolrConnector/SolrConnectorPluginBase.php
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 917

Class

SolrConnectorPluginBase
Defines a base class for Solr connector plugins.

Namespace

Drupal\search_api_solr\SolrConnector

Code

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