aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>2020-05-17 08:10:36 +0000
committerGerrit Code Review <gerrit@wikimedia.org>2020-05-17 08:10:36 +0000
commit07e751dab39c723bc50b0701d7e2f62595e62bcc (patch)
tree9e893928662ffef09f581ca5297531a1b3b27b2c
parent60fdd5d8cd6dedde7cbfd05b45b7a33b114b79dc (diff)
parent1996c78545ebfc0a1980b3d9ea1ba88d8bc75691 (diff)
downloadmediawikicore-07e751dab39c723bc50b0701d7e2f62595e62bcc.tar.gz
mediawikicore-07e751dab39c723bc50b0701d7e2f62595e62bcc.zip
Merge "In SwiftFileBackend allow HTTP timeouts to be set in the constructor"
-rw-r--r--includes/libs/filebackend/SwiftFileBackend.php14
1 files changed, 13 insertions, 1 deletions
diff --git a/includes/libs/filebackend/SwiftFileBackend.php b/includes/libs/filebackend/SwiftFileBackend.php
index c466b52881f9..d0fbae5ba505 100644
--- a/includes/libs/filebackend/SwiftFileBackend.php
+++ b/includes/libs/filebackend/SwiftFileBackend.php
@@ -110,6 +110,10 @@ class SwiftFileBackend extends FileBackendStore {
* - writeUsers : Swift users with write access to public containers (account:username)
* - secureReadUsers : Swift users with read access to private containers (account:username)
* - secureWriteUsers : Swift users with write access to private containers (account:username)
+ * - connTimeout : The HTTP connect timeout to use when connecting to Swift, in
+ * seconds.
+ * - reqTimeout : The HTTP request timeout to use when communicating with Swift, in
+ * seconds.
*/
public function __construct( array $config ) {
parent::__construct( $config );
@@ -124,8 +128,16 @@ class SwiftFileBackend extends FileBackendStore {
$this->shardViaHashLevels = $config['shardViaHashLevels'] ?? '';
$this->rgwS3AccessKey = $config['rgwS3AccessKey'] ?? '';
$this->rgwS3SecretKey = $config['rgwS3SecretKey'] ?? '';
+
// HTTP helper client
- $this->http = new MultiHttpClient( [] );
+ $httpOptions = [];
+ foreach ( [ 'connTimeout', 'reqTimeout' ] as $optionName ) {
+ if ( isset( $config[$optionName] ) ) {
+ $httpOptions[$optionName] = $config[$optionName];
+ }
+ }
+ $this->http = new MultiHttpClient( $httpOptions );
+
// Cache container information to mask latency
if ( isset( $config['wanCache'] ) && $config['wanCache'] instanceof WANObjectCache ) {
$this->memCache = $config['wanCache'];