diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs index 85b55f709b..825686b6ea 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs @@ -173,6 +173,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase m_ScriptEngine = _ScriptEngine; ReadConfig(); + AdjustNumberOfScriptThreads(); } public void ReadConfig() diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs index 47fe81548c..e0ec27fe34 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs @@ -131,6 +131,8 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase long Last_ReReadConfigFilens = DateTime.Now.Ticks; int MaintenanceLoopTicks_ScriptLoadUnload_Count = 0; int MaintenanceLoopTicks_Other_Count = 0; + bool MaintenanceLoopTicks_ScriptLoadUnload_ResetCount = false; + bool MaintenanceLoopTicks_Other_ResetCount = false; while (true) { @@ -140,6 +142,18 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase { System.Threading.Thread.Sleep(MaintenanceLoopms); // Sleep before next pass + // Reset counters? + if (MaintenanceLoopTicks_ScriptLoadUnload_ResetCount) + { + MaintenanceLoopTicks_ScriptLoadUnload_ResetCount = false; + MaintenanceLoopTicks_ScriptLoadUnload_Count = 0; + } + if (MaintenanceLoopTicks_Other_ResetCount) + { + MaintenanceLoopTicks_Other_ResetCount = false; + MaintenanceLoopTicks_Other_Count = 0; + } + // Increase our counters MaintenanceLoopTicks_ScriptLoadUnload_Count++; MaintenanceLoopTicks_Other_Count++; @@ -151,7 +165,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase // Re-reading config every x seconds if (MaintenanceLoopTicks_Other_Count >= MaintenanceLoopTicks_Other) { - MaintenanceLoopTicks_Other_Count = 0; + MaintenanceLoopTicks_Other_ResetCount = true; if (m_ScriptEngine.RefreshConfigFilens > 0) { @@ -187,7 +201,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase } if (MaintenanceLoopTicks_ScriptLoadUnload_Count >= MaintenanceLoopTicks_ScriptLoadUnload) { - MaintenanceLoopTicks_ScriptLoadUnload_Count = 0; + MaintenanceLoopTicks_ScriptLoadUnload_ResetCount = true; // LOAD / UNLOAD SCRIPTS if (m_ScriptEngine.m_ScriptManager != null) m_ScriptEngine.m_ScriptManager.DoScriptLoadUnload();