Add a MaxRetries option to the inventory connector.

If clustered services are used, another try would go to another server
and may succeed.
melanie
Melanie Thielker 2016-12-29 16:29:44 +00:00
parent 07b48fd58c
commit e0b5135010
2 changed files with 16 additions and 2 deletions

View File

@ -54,6 +54,8 @@ namespace OpenSim.Services.Connectors
private string m_ServerURI = String.Empty; private string m_ServerURI = String.Empty;
private int m_maxRetries = 0;
/// <summary> /// <summary>
/// Timeout for remote requests. /// Timeout for remote requests.
/// </summary> /// </summary>
@ -100,6 +102,7 @@ namespace OpenSim.Services.Connectors
m_ServerURI = serviceURI; m_ServerURI = serviceURI;
m_requestTimeoutSecs = config.GetInt("RemoteRequestTimeout", m_requestTimeoutSecs); m_requestTimeoutSecs = config.GetInt("RemoteRequestTimeout", m_requestTimeoutSecs);
m_maxRetries = config.GetInt("MaxRetries", m_maxRetries);
StatsManager.RegisterStat( StatsManager.RegisterStat(
new Stat( new Stat(
@ -700,11 +703,21 @@ namespace OpenSim.Services.Connectors
RequestsMade++; RequestsMade++;
string reply string reply = String.Empty;
= SynchronousRestFormsRequester.MakeRequest( int retries = 0;
do
{
reply = SynchronousRestFormsRequester.MakeRequest(
"POST", m_ServerURI + "/xinventory", "POST", m_ServerURI + "/xinventory",
ServerUtils.BuildQueryString(sendData), m_requestTimeoutSecs, m_Auth); ServerUtils.BuildQueryString(sendData), m_requestTimeoutSecs, m_Auth);
if (reply != String.Empty)
break;
retries++;
} while (retries <= m_maxRetries);
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse( Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(
reply); reply);

View File

@ -85,6 +85,7 @@
; Change this to your grid-wide inventory server ; Change this to your grid-wide inventory server
; ;
InventoryServerURI = "${Const|BaseURL}:${Const|PrivatePort}" InventoryServerURI = "${Const|BaseURL}:${Const|PrivatePort}"
;MaxRetries = 0
[GridInfo] [GridInfo]
; ;