diff --git a/config/vufind/DAIA.ini b/config/vufind/DAIA.ini index 2986e6b32eabf2b65f5a8d3c0e1c6dcef3bba931..97b0cfe2e0c3a3dddf97d6318c402369fca6b862 100644 --- a/config/vufind/DAIA.ini +++ b/config/vufind/DAIA.ini @@ -24,6 +24,11 @@ ; The base URL for the DAIA webservice. baseUrl = [your DAIA server base url] +; Set a DAIA specific timeout in seconds to be used for DAIA http requests (defaults +; to Zend defaults or as defined in +; vendor/vufind-org/vufindhttp/src/VuFindHttp/HttpService.php) +;timeout = 30 + ; The prefix prepended to the VuFind record Id resulting in the document URI ; used for the DAIA request (default = ppn:) (the prefix usually defines the ; field which the DAIA server uses for the loookup - e.g. ppn: or isbn:). diff --git a/config/vufind/PAIA.ini b/config/vufind/PAIA.ini index dd7ade3a47ece701f5d681b07ad14bff565f8643..38f6e661c4da13f6f16f45ad0a3338f0ea0a3184 100644 --- a/config/vufind/PAIA.ini +++ b/config/vufind/PAIA.ini @@ -9,6 +9,11 @@ ; base URL of the PAIA server WITH trailing slash baseUrl = "" +; Set a PAIA specific timeout in seconds to be used for PAIA http requests (defaults +; to Zend defaults or as defined in +; vendor/vufind-org/vufindhttp/src/VuFindHttp/HttpService.php) +;timeout = 30 + ; Enable caching for PAIA items (default is false). TTL for cached data will be the ; same as for DAIA cache (see cacheLifetime setting in DAIA.ini). ;paiaCache = false diff --git a/module/VuFind/src/VuFind/ILS/Driver/DAIA.php b/module/VuFind/src/VuFind/ILS/Driver/DAIA.php index 2395dbc0dac0f322cac596c0a0691f81072746bb..3d08827771f47bf5fed01bc4e5b62aea01fa6c55 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/DAIA.php +++ b/module/VuFind/src/VuFind/ILS/Driver/DAIA.php @@ -59,6 +59,13 @@ class DAIA extends AbstractBase implements */ protected $baseUrl; + /** + * Timeout in seconds to be used for DAIA http requests + * + * @var string + */ + protected $daiaTimeout = null; + /** * Flag to switch on/off caching for DAIA items * @@ -142,6 +149,10 @@ class DAIA extends AbstractBase implements } else { throw new ILSException('DAIA/baseUrl configuration needs to be set.'); } + // use DAIA specific timeout setting for http requests if configured + if ((isset($this->config['DAIA']['timeout']))) { + $this->daiaTimeout = $this->config['DAIA']['timeout']; + } if (isset($this->config['DAIA']['daiaResponseFormat'])) { $this->daiaResponseFormat = strtolower( $this->config['DAIA']['daiaResponseFormat'] @@ -448,7 +459,7 @@ class DAIA extends AbstractBase implements try { $result = $this->httpService->get( $this->baseUrl, - $params, null, $http_headers + $params, $this->daiaTimeout, $http_headers ); } catch (\Exception $e) { throw new ILSException( diff --git a/module/VuFind/src/VuFind/ILS/Driver/PAIA.php b/module/VuFind/src/VuFind/ILS/Driver/PAIA.php index df079cbaaee23ecdb908083756215a68c35e4d5a..9129e7270b09ea0e0b9b972d8d1bd8daa9cd4a0f 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/PAIA.php +++ b/module/VuFind/src/VuFind/ILS/Driver/PAIA.php @@ -56,6 +56,13 @@ class PAIA extends DAIA */ protected $paiaURL; + /** + * Timeout in seconds to be used for PAIA http requests + * + * @var + */ + protected $paiaTimeout = null; + /** * Flag to switch on/off caching for PAIA items * @@ -164,6 +171,11 @@ class PAIA extends DAIA } $this->paiaURL = $this->config['PAIA']['baseUrl']; + // use PAIA specific timeout setting for http requests if configured + if ((isset($this->config['PAIA']['timeout']))) { + $this->paiaTimeout = $this->config['PAIA']['timeout']; + } + // do we have caching enabled for PAIA if (isset($this->config['PAIA']['paiaCache'])) { $this->paiaCacheEnabled = $this->config['PAIA']['paiaCache']; @@ -1502,7 +1514,7 @@ class PAIA extends DAIA $this->paiaURL . $file, $postData, 'application/json; charset=UTF-8', - null, + $this->paiaTimeout, $http_headers ); } catch (\Exception $e) { @@ -1539,7 +1551,7 @@ class PAIA extends DAIA try { $result = $this->httpService->get( $this->paiaURL . $file, - [], null, $http_headers + [], $this->paiaTimeout, $http_headers ); } catch (\Exception $e) { throw new ILSException($e->getMessage());