File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -57,6 +57,9 @@ class CloudFederationProviderManager implements ICloudFederationProviderManager
5757 /** @var ILogger */
5858 private $ logger ;
5959
60+ /** @var array cache OCM end-points */
61+ private $ ocmEndPoints = [];
62+
6063 private $ supportedAPIVersion = '1.0-proposal1 ' ;
6164
6265 /**
@@ -208,10 +211,16 @@ public function isReady() {
208211 * @return string
209212 */
210213 protected function getOCMEndPoint ($ url ) {
214+
215+ if (isset ($ this ->ocmEndPoints [$ url ])) {
216+ return $ this ->ocmEndPoints [$ url ];
217+ }
218+
211219 $ client = $ this ->httpClientService ->newClient ();
212220 try {
213221 $ response = $ client ->get ($ url . '/ocm-provider/ ' , ['timeout ' => 10 , 'connect_timeout ' => 10 ]);
214222 } catch (\Exception $ e ) {
223+ $ this ->ocmEndPoints [$ url ] = '' ;
215224 return '' ;
216225 }
217226
@@ -221,9 +230,11 @@ protected function getOCMEndPoint($url) {
221230 $ supportedVersion = isset ($ result ['apiVersion ' ]) && $ result ['apiVersion ' ] === $ this ->supportedAPIVersion ;
222231
223232 if (isset ($ result ['endPoint ' ]) && $ supportedVersion ) {
233+ $ this ->ocmEndPoints [$ url ] = $ result ['endPoint ' ];
224234 return $ result ['endPoint ' ];
225235 }
226236
237+ $ this ->ocmEndPoints [$ url ] = '' ;
227238 return '' ;
228239 }
229240
You can’t perform that action at this time.
0 commit comments