From d8e172f7138e60f3c89a6fbb395d093ca748ace7 Mon Sep 17 00:00:00 2001 From: Marko Obrovac Date: Wed, 13 Apr 2016 21:28:24 +0200 Subject: [PATCH] Allow the number of concurrent connections to be configurable The MultiHttpClient class allows the user to set the number of concurrent connections it keeps open. This patch simply allows users of the Math extension to set it when connecting to RESTBase. Note that this patch is effectively a no-op, since MultiHttpClient's default is (also) 50. Bug: T132096 Change-Id: If9b6e61ffa23f8d22b3aab874058e809ff4c74b8 --- MathRestbaseInterface.php | 5 +++-- extension.json | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/MathRestbaseInterface.php b/MathRestbaseInterface.php index 747ba79..8a4fbaa 100644 --- a/MathRestbaseInterface.php +++ b/MathRestbaseInterface.php @@ -151,8 +151,9 @@ class MathRestbaseInterface { } private function getServiceClient() { - global $wgVirtualRestConfig; - $serviceClient = new VirtualRESTServiceClient( new MultiHttpClient( [] ) ); + global $wgVirtualRestConfig, $wgMathConcurrentReqs; + $http = new MultiHttpClient( [ 'maxConnsPerHost' => $wgMathConcurrentReqs ] ); + $serviceClient = new VirtualRESTServiceClient( $http ); if ( isset( $wgVirtualRestConfig['modules']['restbase'] ) ) { $cfg = $wgVirtualRestConfig['modules']['restbase']; $cfg['parsoidCompat'] = false; diff --git a/extension.json b/extension.json index 75d1cdc..4f2a525 100644 --- a/extension.json +++ b/extension.json @@ -108,6 +108,7 @@ "MathMathMLTimeout": 20, "MathMathMLUrl": "http://mathoid.testme.wmflabs.org", "MathFullRestbaseURL": false, + "MathConcurrentReqs": 50, "MathPath": false, "MathTexvcCheckExecutable": false, "MathValidModes": [