throtle datasnapshot gen

This commit is contained in:
UbitUmarov
2018-01-22 18:37:39 +00:00
parent e3fc272f50
commit efc7480342
2 changed files with 22 additions and 5 deletions

View File

@@ -32,6 +32,7 @@ using System.IO;
using System.Linq;
using System.Net;
using System.Reflection;
using System.Threading;
using System.Text;
using System.Xml;
using log4net;
@@ -64,6 +65,7 @@ namespace OpenSim.Region.DataSnapshot
//Various internal objects
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
internal object m_syncInit = new object();
private object m_serializeGen = new object();
//DataServices and networking
private string m_dataServices = "noservices";
@@ -321,6 +323,11 @@ namespace OpenSim.Region.DataSnapshot
*/
public XmlDocument GetSnapshot(string regionName)
{
if(!Monitor.TryEnter(m_serializeGen,30000))
{
return null;
}
CheckStale();
XmlDocument requestedSnap = new XmlDocument();
@@ -360,9 +367,13 @@ namespace OpenSim.Region.DataSnapshot
m_log.Warn("[DATASNAPSHOT]: Caught unknown exception while trying to load snapshot: " + e.StackTrace);
requestedSnap = GetErrorMessage(regionName, e);
}
finally
{
Monitor.Exit(m_serializeGen);
}
return requestedSnap;
}
private XmlDocument GetErrorMessage(string regionName, Exception e)