From 785b641272f0e41c50d42406496baee10e5303a9 Mon Sep 17 00:00:00 2001 From: Tedd Hansen Date: Sat, 2 Feb 2008 07:53:13 +0000 Subject: fixed a timing bug in config re-read. Apparently there is 1000000000 ns in one second... --- .../Common/ScriptEngineBase/MaintenanceThread.cs | 7 ++++--- .../ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs | 12 ++++++------ 2 files changed, 10 insertions(+), 9 deletions(-) (limited to 'OpenSim/Region/ScriptEngine') diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs index ae6f001..57e56d4 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs @@ -90,12 +90,12 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase m_ScriptEngine.Log.Warn(m_ScriptEngine.ScriptEngineName, "Configuration error: MaxEventExecutionTimeMs is less than MaintenanceLoopms. The Maintenance Loop will only check scripts once per run."); + long Last_maxFunctionExecutionTimens = 0; // DateTime.Now.Ticks; + long Last_ReReadConfigFilens = DateTime.Now.Ticks; while (true) { try { - long Last_maxFunctionExecutionTimens = 0; // DateTime.Now.Ticks; - long Last_ReReadConfigFilens = DateTime.Now.Ticks; while (true) { System.Threading.Thread.Sleep(MaintenanceLoopms); // Sleep before next pass @@ -107,11 +107,12 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase // // Re-reading config every x seconds // - if (m_ScriptEngine.RefreshConfigFileSeconds > 0) + if (m_ScriptEngine.RefreshConfigFilens > 0) { // Check if its time to re-read config if (DateTime.Now.Ticks - Last_ReReadConfigFilens > m_ScriptEngine.RefreshConfigFilens) { + //Console.WriteLine("Time passed: " + (DateTime.Now.Ticks - Last_ReReadConfigFilens) + ">" + m_ScriptEngine.RefreshConfigFilens ); // Its time to re-read config file m_ScriptEngine.ReadConfig(); Last_ReReadConfigFilens = DateTime.Now.Ticks; // Reset time diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs index 4cf39b4..f09e631 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs @@ -61,10 +61,10 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase /// How many seconds between re-reading config-file. 0 = never. ScriptEngine will try to adjust to new config changes. /// public int RefreshConfigFileSeconds { - get { return (int)(RefreshConfigFilens / 10000); } - set { RefreshConfigFilens = value * 10000; } + get { return (int)(RefreshConfigFilens / 10000000); } + set { RefreshConfigFilens = value * 10000000; } } - public long RefreshConfigFilens = 0; + public long RefreshConfigFilens; public ScriptManager GetScriptManager() { @@ -131,9 +131,9 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase } public void ReadConfig() { -#if DEBUG - Log.Debug(ScriptEngineName, "Refreshing configuration for all modules"); -#endif +//#if DEBUG +// Log.Debug(ScriptEngineName, "Refreshing configuration for all modules"); +//#endif RefreshConfigFileSeconds = ScriptConfigSource.GetInt("RefreshConfig", 30); // Reload from disk? No! -- cgit v1.1