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 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'OpenSim/Services') 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); -- cgit v1.1