From 0b7736b8619e4004f8852df6d3d361b421e51202 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 9 Sep 2014 18:26:41 +0100 Subject: [PATCH] Temporarily add root agent rez attachments work to job engine if it is running rather than as a fire and forget. Experiment to see if serializing attachment rez and send initial data jobs improves other parts of sim performance. --- OpenSim/Framework/Monitoring/Watchdog.cs | 8 ++++---- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 12 ++++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/OpenSim/Framework/Monitoring/Watchdog.cs b/OpenSim/Framework/Monitoring/Watchdog.cs index 2baf364bca..89ae11f12a 100644 --- a/OpenSim/Framework/Monitoring/Watchdog.cs +++ b/OpenSim/Framework/Monitoring/Watchdog.cs @@ -133,7 +133,7 @@ namespace OpenSim.Framework.Monitoring /// /summary> public static event Action OnWatchdogTimeout; - private static JobEngine m_jobEngine; + public static JobEngine JobEngine { get; private set; } /// /// Is this watchdog active? @@ -175,7 +175,7 @@ namespace OpenSim.Framework.Monitoring static Watchdog() { - m_jobEngine = new JobEngine(); + JobEngine = new JobEngine(); m_threads = new Dictionary(); m_watchdogTimer = new System.Timers.Timer(WATCHDOG_INTERVAL_MS); m_watchdogTimer.AutoReset = false; @@ -462,8 +462,8 @@ namespace OpenSim.Framework.Monitoring return; } - if (m_jobEngine.IsRunning) - m_jobEngine.QueueRequest(name, callback, obj); + if (JobEngine.IsRunning) + JobEngine.QueueRequest(name, callback, obj); else RunInThread(callback, name, obj, log); } diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 47d7e0d2e6..fdf0ac66fa 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1228,10 +1228,14 @@ namespace OpenSim.Region.Framework.Scenes // viewers without (e.g. v1 viewers) will not, so we still need to make this call. if (Scene.AttachmentsModule != null) { - Util.FireAndForget(o => - { - Scene.AttachmentsModule.RezAttachments(this); - }); + if (Watchdog.JobEngine.IsRunning) + Watchdog.RunWhenPossible( + "RezAttachments", + o => Scene.AttachmentsModule.RezAttachments(this), + string.Format("Rez attachments for {0} in {1}", Name, Scene.Name), + null); + else + Util.FireAndForget(o => Scene.AttachmentsModule.RezAttachments(this)); } } else