diff options
author | Melanie Thielker | 2016-12-29 16:29:44 +0000 |
---|---|---|
committer | Melanie Thielker | 2016-12-29 16:29:44 +0000 |
commit | e0b5135010f2292f5c28232e874841b5ed92a559 (patch) | |
tree | a600053b00b9f063afe01afd745d529f4007305f /OpenSim/Services/Connectors | |
parent | Add negative caching to flotsam cache. Prevents scripts from hammering the as... (diff) | |
download | opensim-SC-e0b5135010f2292f5c28232e874841b5ed92a559.zip opensim-SC-e0b5135010f2292f5c28232e874841b5ed92a559.tar.gz opensim-SC-e0b5135010f2292f5c28232e874841b5ed92a559.tar.bz2 opensim-SC-e0b5135010f2292f5c28232e874841b5ed92a559.tar.xz |
Add a MaxRetries option to the inventory connector.
If clustered services are used, another try would go to another server
and may succeed.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs | 17 |
1 files changed, 15 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 | |||
54 | 54 | ||
55 | private string m_ServerURI = String.Empty; | 55 | private string m_ServerURI = String.Empty; |
56 | 56 | ||
57 | private int m_maxRetries = 0; | ||
58 | |||
57 | /// <summary> | 59 | /// <summary> |
58 | /// Timeout for remote requests. | 60 | /// Timeout for remote requests. |
59 | /// </summary> | 61 | /// </summary> |
@@ -100,6 +102,7 @@ namespace OpenSim.Services.Connectors | |||
100 | m_ServerURI = serviceURI; | 102 | m_ServerURI = serviceURI; |
101 | 103 | ||
102 | m_requestTimeoutSecs = config.GetInt("RemoteRequestTimeout", m_requestTimeoutSecs); | 104 | m_requestTimeoutSecs = config.GetInt("RemoteRequestTimeout", m_requestTimeoutSecs); |
105 | m_maxRetries = config.GetInt("MaxRetries", m_maxRetries); | ||
103 | 106 | ||
104 | StatsManager.RegisterStat( | 107 | StatsManager.RegisterStat( |
105 | new Stat( | 108 | new Stat( |
@@ -700,10 +703,20 @@ namespace OpenSim.Services.Connectors | |||
700 | 703 | ||
701 | RequestsMade++; | 704 | RequestsMade++; |
702 | 705 | ||
703 | string reply | 706 | string reply = String.Empty; |
704 | = SynchronousRestFormsRequester.MakeRequest( | 707 | int retries = 0; |
708 | |||
709 | do | ||
710 | { | ||
711 | reply = SynchronousRestFormsRequester.MakeRequest( | ||
705 | "POST", m_ServerURI + "/xinventory", | 712 | "POST", m_ServerURI + "/xinventory", |
706 | ServerUtils.BuildQueryString(sendData), m_requestTimeoutSecs, m_Auth); | 713 | ServerUtils.BuildQueryString(sendData), m_requestTimeoutSecs, m_Auth); |
714 | |||
715 | if (reply != String.Empty) | ||
716 | break; | ||
717 | |||
718 | retries++; | ||
719 | } while (retries <= m_maxRetries); | ||
707 | 720 | ||
708 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse( | 721 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse( |
709 | reply); | 722 | reply); |