diff options
author | Diva Canto | 2013-07-16 13:01:39 -0700 |
---|---|---|
committer | Diva Canto | 2013-07-16 13:01:39 -0700 |
commit | e0f0b88dece110ca10208a2f826f9e360a9d7826 (patch) | |
tree | 898d5d485db4bc1ebd2a48cead0ae6008628b39b /OpenSim/Region/CoreModules/Framework/UserManagement | |
parent | Actually use DoubleQueue in UserManagement/UserManagementModule (diff) | |
download | opensim-SC_OLD-e0f0b88dece110ca10208a2f826f9e360a9d7826.zip opensim-SC_OLD-e0f0b88dece110ca10208a2f826f9e360a9d7826.tar.gz opensim-SC_OLD-e0f0b88dece110ca10208a2f826f9e360a9d7826.tar.bz2 opensim-SC_OLD-e0f0b88dece110ca10208a2f826f9e360a9d7826.tar.xz |
In the pursuit of using less CPU: now trying to avoid blocking queues altogether. Instead, this uses a timer. No sure if it's better or worse, but worth the try.
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework/UserManagement')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs | 64 |
1 files changed, 57 insertions, 7 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs index 9f5e4ae..61c1e70 100644 --- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs +++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs | |||
@@ -61,8 +61,10 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
61 | 61 | ||
62 | // Throttle the name requests | 62 | // Throttle the name requests |
63 | //private OpenSim.Framework.BlockingQueue<NameRequest> m_RequestQueue = new OpenSim.Framework.BlockingQueue<NameRequest>(); | 63 | //private OpenSim.Framework.BlockingQueue<NameRequest> m_RequestQueue = new OpenSim.Framework.BlockingQueue<NameRequest>(); |
64 | private OpenSim.Framework.DoubleQueue<NameRequest> m_RequestQueue = new OpenSim.Framework.DoubleQueue<NameRequest>(); | 64 | //private OpenSim.Framework.DoubleQueue<NameRequest> m_RequestQueue = new OpenSim.Framework.DoubleQueue<NameRequest>(); |
65 | private Queue<NameRequest> m_RequestQueue = new Queue<NameRequest>(); | ||
65 | 66 | ||
67 | private System.Timers.Timer m_timer; | ||
66 | 68 | ||
67 | #region ISharedRegionModule | 69 | #region ISharedRegionModule |
68 | 70 | ||
@@ -599,12 +601,18 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
599 | protected void Init() | 601 | protected void Init() |
600 | { | 602 | { |
601 | RegisterConsoleCmds(); | 603 | RegisterConsoleCmds(); |
602 | Watchdog.StartThread( | 604 | //Watchdog.StartThread( |
603 | ProcessQueue, | 605 | // ProcessQueue, |
604 | "NameRequestThread", | 606 | // "NameRequestThread", |
605 | ThreadPriority.BelowNormal, | 607 | // ThreadPriority.BelowNormal, |
606 | true, | 608 | // true, |
607 | false); | 609 | // false); |
610 | |||
611 | m_timer = new System.Timers.Timer(); | ||
612 | m_timer.AutoReset = false; | ||
613 | m_timer.Interval = 15000; // 15 secs at first | ||
614 | m_timer.Elapsed += ProcessQueue; | ||
615 | m_timer.Start(); | ||
608 | 616 | ||
609 | } | 617 | } |
610 | 618 | ||
@@ -698,6 +706,48 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
698 | } | 706 | } |
699 | } | 707 | } |
700 | 708 | ||
709 | private bool AreThereRootAgents() | ||
710 | { | ||
711 | foreach (Scene s in m_Scenes) | ||
712 | { | ||
713 | if (s.GetRootAgentCount() > 0) | ||
714 | return true; | ||
715 | } | ||
716 | |||
717 | return false; | ||
718 | } | ||
719 | |||
720 | private void ProcessQueue(object sender, System.Timers.ElapsedEventArgs e) | ||
721 | { | ||
722 | while (m_RequestQueue.Count > 0) | ||
723 | { | ||
724 | NameRequest request = null; | ||
725 | lock (m_RequestQueue) | ||
726 | request = m_RequestQueue.Dequeue(); | ||
727 | |||
728 | if (request != null) | ||
729 | { | ||
730 | string[] names; | ||
731 | bool foundRealName = TryGetUserNames(request.uuid, out names); | ||
732 | |||
733 | if (names.Length == 2) | ||
734 | { | ||
735 | if (!foundRealName) | ||
736 | m_log.DebugFormat("[USER MANAGEMENT MODULE]: Sending {0} {1} for {2} to {3} since no bound name found", names[0], names[1], request.uuid, request.client.Name); | ||
737 | |||
738 | request.client.SendNameReply(request.uuid, names[0], names[1]); | ||
739 | } | ||
740 | } | ||
741 | } | ||
742 | |||
743 | if (AreThereRootAgents()) | ||
744 | m_timer.Interval = 1000; // 1 sec | ||
745 | else | ||
746 | m_timer.Interval = 10000; // 10 secs | ||
747 | |||
748 | m_timer.Start(); | ||
749 | |||
750 | } | ||
701 | } | 751 | } |
702 | 752 | ||
703 | class NameRequest | 753 | class NameRequest |