aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Framework
diff options
context:
space:
mode:
authorDiva Canto2013-07-16 19:04:30 -0700
committerDiva Canto2013-07-16 19:04:30 -0700
commit9432f3c94d0b0345132e5ff9eaf966b96cf218c2 (patch)
tree659944db7a09bd871a70ded726693f2a3e321c59 /OpenSim/Region/CoreModules/Framework
parentUserManagementModule: in the continuation, call the method that also looks up... (diff)
downloadopensim-SC_OLD-9432f3c94d0b0345132e5ff9eaf966b96cf218c2.zip
opensim-SC_OLD-9432f3c94d0b0345132e5ff9eaf966b96cf218c2.tar.gz
opensim-SC_OLD-9432f3c94d0b0345132e5ff9eaf966b96cf218c2.tar.bz2
opensim-SC_OLD-9432f3c94d0b0345132e5ff9eaf966b96cf218c2.tar.xz
Improvements to the ServiceThrottleModule: added a category and an itemid to the interface, so that duplicate requests aren't enqueued more than once.
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework')
-rw-r--r--OpenSim/Region/CoreModules/Framework/ServiceThrottle/ServiceThrottleModule.cs35
-rw-r--r--OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs2
2 files changed, 27 insertions, 10 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/ServiceThrottle/ServiceThrottleModule.cs b/OpenSim/Region/CoreModules/Framework/ServiceThrottle/ServiceThrottleModule.cs
index a3ca6d6..1554b3e 100644
--- a/OpenSim/Region/CoreModules/Framework/ServiceThrottle/ServiceThrottleModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/ServiceThrottle/ServiceThrottleModule.cs
@@ -50,17 +50,15 @@ namespace OpenSim.Region.CoreModules.Framework
50 private readonly List<Scene> m_scenes = new List<Scene>(); 50 private readonly List<Scene> m_scenes = new List<Scene>();
51 private System.Timers.Timer m_timer = new System.Timers.Timer(); 51 private System.Timers.Timer m_timer = new System.Timers.Timer();
52 52
53 //private OpenSim.Framework.BlockingQueue<GridRegionRequest> m_RequestQueue = new OpenSim.Framework.BlockingQueue<GridRegionRequest>();
54 // private OpenSim.Framework.DoubleQueue<GridRegionRequest> m_RequestQueue = new OpenSim.Framework.DoubleQueue<GridRegionRequest>();
55 //private Queue<GridRegionRequest> m_RequestQueue = new Queue<GridRegionRequest>();
56 private Queue<Action> m_RequestQueue = new Queue<Action>(); 53 private Queue<Action> m_RequestQueue = new Queue<Action>();
54 private Dictionary<string, List<string>> m_Pending = new Dictionary<string, List<string>>();
57 private int m_Interval; 55 private int m_Interval;
58 56
59 #region ISharedRegionModule 57 #region ISharedRegionModule
60 58
61 public void Initialise(IConfigSource config) 59 public void Initialise(IConfigSource config)
62 { 60 {
63 m_Interval = Util.GetConfigVarFromSections<int>(config, "Interval", new string[] { "ServiceThrottle" }, 2000); 61 m_Interval = Util.GetConfigVarFromSections<int>(config, "Interval", new string[] { "ServiceThrottle" }, 5000);
64 62
65 m_timer = new System.Timers.Timer(); 63 m_timer = new System.Timers.Timer();
66 m_timer.AutoReset = false; 64 m_timer.AutoReset = false;
@@ -159,18 +157,37 @@ namespace OpenSim.Region.CoreModules.Framework
159 client.SendRegionHandle(regionID, r.RegionHandle); 157 client.SendRegionHandle(regionID, r.RegionHandle);
160 }; 158 };
161 159
162 lock (m_RequestQueue) 160 Enqueue("region", regionID.ToString(), action);
163 m_RequestQueue.Enqueue(action);
164
165 } 161 }
166 162
167 #endregion Events 163 #endregion Events
168 164
169 #region IServiceThrottleModule 165 #region IServiceThrottleModule
170 166
171 public void Enqueue(Action continuation) 167 public void Enqueue(string category, string itemid, Action continuation)
172 { 168 {
173 m_RequestQueue.Enqueue(continuation); 169 lock (m_RequestQueue)
170 {
171 if (m_Pending.ContainsKey(category))
172 {
173 if (m_Pending[category].Contains(itemid))
174 // Don't enqueue, it's already pending
175 return;
176 }
177 else
178 m_Pending.Add(category, new List<string>());
179
180 m_Pending[category].Add(itemid);
181
182 m_RequestQueue.Enqueue(delegate
183 {
184 continuation();
185 lock (m_RequestQueue)
186 {
187 m_Pending[category].Remove(itemid);
188 }
189 });
190 }
174 } 191 }
175 192
176 #endregion IServiceThrottleModule 193 #endregion IServiceThrottleModule
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
index e8bdcc9..a91adfa 100644
--- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
@@ -173,7 +173,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
173 } 173 }
174 174
175 // Not found in cache, queue continuation 175 // Not found in cache, queue continuation
176 m_ServiceThrottle.Enqueue(delegate 176 m_ServiceThrottle.Enqueue("name", uuid.ToString(), delegate
177 { 177 {
178 //m_log.DebugFormat("[YYY]: Name request {0}", uuid); 178 //m_log.DebugFormat("[YYY]: Name request {0}", uuid);
179 bool foundRealName = TryGetUserNames(uuid, names); 179 bool foundRealName = TryGetUserNames(uuid, names);