Skip to content
Snippets Groups Projects
Commit 8d861513 authored by Demian Katz's avatar Demian Katz
Browse files

Configurable Syndetics timeout.

parent c25b844f
Branches
Tags
No related merge requests found
......@@ -591,6 +591,8 @@ authors = Wikipedia
use_ssl = false
plus = false
;plus_id = "MySyndeticsId"
; timeout value (in seconds) for API calls:
timeout = 10
; Booksite CATS Enhanced Content - cover images, reviews, description, etc.
[Booksite]
......
......@@ -53,16 +53,40 @@ abstract class AbstractSyndetics extends AbstractBase
*/
protected $usePlus;
/**
* HTTP timeout for API calls (in seconds)
*
* @var int
*/
protected $timeout;
/**
* Constructor
*
* @param bool $useSSL Use SSL URLs?
* @param bool $usePlus Use Syndetics Plus?
* @param int $timeout HTTP timeout for API calls (in seconds)
*/
public function __construct($useSSL = false, $usePlus = false)
public function __construct($useSSL = false, $usePlus = false, $timeout = 10)
{
$this->useSSL = $useSSL;
$this->usePlus = $usePlus;
$this->timeout = $timeout;
}
/**
* Get an HTTP client
*
* @param string $url URL for client to use
*
* @return \Zend\Http\Client
* @throws \Exception
*/
protected function getHttpClient($url)
{
$client = parent::getHttpClient($url);
$client->setOptions(array('timeout' => $this->timeout));
return $client;
}
/**
......
......@@ -52,7 +52,8 @@ class Factory
$config = $sm->getServiceLocator()->get('VuFind\Config')->get('config');
return new Syndetics(
isset($config->Syndetics->use_ssl) && $config->Syndetics->use_ssl,
$plus
$plus,
isset($config->Syndetics->timeout) ? $config->Syndetics->timeout : 10
);
}
......
......@@ -52,7 +52,8 @@ class Factory
$config = $sm->getServiceLocator()->get('VuFind\Config')->get('config');
return new Syndetics(
isset($config->Syndetics->use_ssl) && $config->Syndetics->use_ssl,
$plus
$plus,
isset($config->Syndetics->timeout) ? $config->Syndetics->timeout : 10
);
}
......
......@@ -52,7 +52,8 @@ class Factory
$config = $sm->getServiceLocator()->get('VuFind\Config')->get('config');
return new Syndetics(
isset($config->Syndetics->use_ssl) && $config->Syndetics->use_ssl,
$plus
$plus,
isset($config->Syndetics->timeout) ? $config->Syndetics->timeout : 10
);
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment