From efc74803424a5e12ce780ecdd839d144123ae79e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 22 Jan 2018 18:37:39 +0000 Subject: throtle datasnapshot gen --- .../OptionalModules/DataSnapshot/DataSnapshotManager.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/OptionalModules/DataSnapshot/DataSnapshotManager.cs') diff --git a/OpenSim/Region/OptionalModules/DataSnapshot/DataSnapshotManager.cs b/OpenSim/Region/OptionalModules/DataSnapshot/DataSnapshotManager.cs index 0436f96..88fa1ae 100644 --- a/OpenSim/Region/OptionalModules/DataSnapshot/DataSnapshotManager.cs +++ b/OpenSim/Region/OptionalModules/DataSnapshot/DataSnapshotManager.cs @@ -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) -- cgit v1.1