From e0b5135010f2292f5c28232e874841b5ed92a559 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Thu, 29 Dec 2016 16:29:44 +0000 Subject: Add a MaxRetries option to the inventory connector. If clustered services are used, another try would go to another server and may succeed. --- .../Connectors/Inventory/XInventoryServicesConnector.cs | 17 +++++++++++++++-- bin/config-include/GridCommon.ini.example | 1 + 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs b/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs index d80e660..2ddd7a2 100644 --- a/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs @@ -54,6 +54,8 @@ namespace OpenSim.Services.Connectors private string m_ServerURI = String.Empty; + private int m_maxRetries = 0; + /// /// Timeout for remote requests. /// @@ -100,6 +102,7 @@ namespace OpenSim.Services.Connectors m_ServerURI = serviceURI; m_requestTimeoutSecs = config.GetInt("RemoteRequestTimeout", m_requestTimeoutSecs); + m_maxRetries = config.GetInt("MaxRetries", m_maxRetries); StatsManager.RegisterStat( new Stat( @@ -700,10 +703,20 @@ namespace OpenSim.Services.Connectors RequestsMade++; - string reply - = SynchronousRestFormsRequester.MakeRequest( + string reply = String.Empty; + int retries = 0; + + do + { + reply = SynchronousRestFormsRequester.MakeRequest( "POST", m_ServerURI + "/xinventory", ServerUtils.BuildQueryString(sendData), m_requestTimeoutSecs, m_Auth); + + if (reply != String.Empty) + break; + + retries++; + } while (retries <= m_maxRetries); Dictionary replyData = ServerUtils.ParseXmlResponse( reply); diff --git a/bin/config-include/GridCommon.ini.example b/bin/config-include/GridCommon.ini.example index 0922cf5..10a5b47 100644 --- a/bin/config-include/GridCommon.ini.example +++ b/bin/config-include/GridCommon.ini.example @@ -85,6 +85,7 @@ ; Change this to your grid-wide inventory server ; InventoryServerURI = "${Const|BaseURL}:${Const|PrivatePort}" + ;MaxRetries = 0 [GridInfo] ; -- cgit v1.1