diff options
author | Justin Clark-Casey (justincc) | 2015-02-04 17:04:59 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2015-02-04 17:04:59 +0000 |
commit | 765fd024183aa855b50ce9c9707abebba55ca63a (patch) | |
tree | 1ab1a4388267e3508c7d8b86549edb11823ef7c2 /OpenSim/Addons/Groups/RemoteConnectorCacheWrapper.cs | |
parent | Fix bug in JobEngine where an attempt to restart after stop would trigger an ... (diff) | |
download | opensim-SC-765fd024183aa855b50ce9c9707abebba55ca63a.zip opensim-SC-765fd024183aa855b50ce9c9707abebba55ca63a.tar.gz opensim-SC-765fd024183aa855b50ce9c9707abebba55ca63a.tar.bz2 opensim-SC-765fd024183aa855b50ce9c9707abebba55ca63a.tar.xz |
For built-in groups, if a delegate throws an exception (e.g. due to network failure), always remove its request from the m_ActiveRequests list.
If this is not done, all subsequent calls for the same data see that a request is apparantly already in progress and so wait for the result indefinitely.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Addons/Groups/RemoteConnectorCacheWrapper.cs | 181 |
1 files changed, 120 insertions, 61 deletions
diff --git a/OpenSim/Addons/Groups/RemoteConnectorCacheWrapper.cs b/OpenSim/Addons/Groups/RemoteConnectorCacheWrapper.cs index f121737..813f796 100644 --- a/OpenSim/Addons/Groups/RemoteConnectorCacheWrapper.cs +++ b/OpenSim/Addons/Groups/RemoteConnectorCacheWrapper.cs | |||
@@ -145,14 +145,20 @@ namespace OpenSim.Groups | |||
145 | 145 | ||
146 | if (firstCall) | 146 | if (firstCall) |
147 | { | 147 | { |
148 | //group = m_GroupsService.GetGroupRecord(RequestingAgentID, GroupID, GroupName); | 148 | try |
149 | group = d(); | 149 | { |
150 | //group = m_GroupsService.GetGroupRecord(RequestingAgentID, GroupID, GroupName); | ||
151 | group = d(); | ||
150 | 152 | ||
151 | lock (m_Cache) | 153 | lock (m_Cache) |
154 | { | ||
155 | m_Cache.AddOrUpdate(cacheKey, group, GROUPS_CACHE_TIMEOUT); | ||
156 | return (ExtendedGroupRecord)group; | ||
157 | } | ||
158 | } | ||
159 | finally | ||
152 | { | 160 | { |
153 | m_Cache.AddOrUpdate(cacheKey, group, GROUPS_CACHE_TIMEOUT); | ||
154 | m_ActiveRequests.Remove(cacheKey); | 161 | m_ActiveRequests.Remove(cacheKey); |
155 | return (ExtendedGroupRecord)group; | ||
156 | } | 162 | } |
157 | } | 163 | } |
158 | else | 164 | else |
@@ -244,13 +250,19 @@ namespace OpenSim.Groups | |||
244 | 250 | ||
245 | if (firstCall) | 251 | if (firstCall) |
246 | { | 252 | { |
247 | membership = d(); | 253 | try |
254 | { | ||
255 | membership = d(); | ||
248 | 256 | ||
249 | lock (m_Cache) | 257 | lock (m_Cache) |
258 | { | ||
259 | m_Cache.AddOrUpdate(cacheKey, membership, GROUPS_CACHE_TIMEOUT); | ||
260 | return (ExtendedGroupMembershipData)membership; | ||
261 | } | ||
262 | } | ||
263 | finally | ||
250 | { | 264 | { |
251 | m_Cache.AddOrUpdate(cacheKey, membership, GROUPS_CACHE_TIMEOUT); | ||
252 | m_ActiveRequests.Remove(cacheKey); | 265 | m_ActiveRequests.Remove(cacheKey); |
253 | return (ExtendedGroupMembershipData)membership; | ||
254 | } | 266 | } |
255 | } | 267 | } |
256 | else | 268 | else |
@@ -287,12 +299,18 @@ namespace OpenSim.Groups | |||
287 | 299 | ||
288 | if (firstCall) | 300 | if (firstCall) |
289 | { | 301 | { |
290 | membership = d(); | 302 | try |
291 | lock (m_Cache) | 303 | { |
304 | membership = d(); | ||
305 | lock (m_Cache) | ||
306 | { | ||
307 | m_Cache.AddOrUpdate(cacheKey, membership, GROUPS_CACHE_TIMEOUT); | ||
308 | return (ExtendedGroupMembershipData)membership; | ||
309 | } | ||
310 | } | ||
311 | finally | ||
292 | { | 312 | { |
293 | m_Cache.AddOrUpdate(cacheKey, membership, GROUPS_CACHE_TIMEOUT); | ||
294 | m_ActiveRequests.Remove(cacheKey); | 313 | m_ActiveRequests.Remove(cacheKey); |
295 | return (ExtendedGroupMembershipData)membership; | ||
296 | } | 314 | } |
297 | } | 315 | } |
298 | else | 316 | else |
@@ -328,12 +346,18 @@ namespace OpenSim.Groups | |||
328 | 346 | ||
329 | if (firstCall) | 347 | if (firstCall) |
330 | { | 348 | { |
331 | memberships = d(); | 349 | try |
332 | lock (m_Cache) | 350 | { |
351 | memberships = d(); | ||
352 | lock (m_Cache) | ||
353 | { | ||
354 | m_Cache.AddOrUpdate(cacheKey, memberships, GROUPS_CACHE_TIMEOUT); | ||
355 | return (List<GroupMembershipData>)memberships; | ||
356 | } | ||
357 | } | ||
358 | finally | ||
333 | { | 359 | { |
334 | m_Cache.AddOrUpdate(cacheKey, memberships, GROUPS_CACHE_TIMEOUT); | ||
335 | m_ActiveRequests.Remove(cacheKey); | 360 | m_ActiveRequests.Remove(cacheKey); |
336 | return (List<GroupMembershipData>)memberships; | ||
337 | } | 361 | } |
338 | } | 362 | } |
339 | else | 363 | else |
@@ -370,20 +394,26 @@ namespace OpenSim.Groups | |||
370 | 394 | ||
371 | if (firstCall) | 395 | if (firstCall) |
372 | { | 396 | { |
373 | List<ExtendedGroupMembersData> _members = d(); | 397 | try |
398 | { | ||
399 | List<ExtendedGroupMembersData> _members = d(); | ||
374 | 400 | ||
375 | if (_members != null && _members.Count > 0) | 401 | if (_members != null && _members.Count > 0) |
376 | members = _members.ConvertAll<GroupMembersData>(new Converter<ExtendedGroupMembersData, GroupMembersData>(m_ForeignImporter.ConvertGroupMembersData)); | 402 | members = _members.ConvertAll<GroupMembersData>(new Converter<ExtendedGroupMembersData, GroupMembersData>(m_ForeignImporter.ConvertGroupMembersData)); |
377 | else | 403 | else |
378 | members = new List<GroupMembersData>(); | 404 | members = new List<GroupMembersData>(); |
379 | 405 | ||
380 | lock (m_Cache) | 406 | lock (m_Cache) |
407 | { | ||
408 | //m_Cache.AddOrUpdate(cacheKey, members, GROUPS_CACHE_TIMEOUT); | ||
409 | m_Cache.AddOrUpdate(cacheKey, _members, GROUPS_CACHE_TIMEOUT); | ||
410 | |||
411 | return (List<GroupMembersData>)members; | ||
412 | } | ||
413 | } | ||
414 | finally | ||
381 | { | 415 | { |
382 | //m_Cache.AddOrUpdate(cacheKey, members, GROUPS_CACHE_TIMEOUT); | ||
383 | m_Cache.AddOrUpdate(cacheKey, _members, GROUPS_CACHE_TIMEOUT); | ||
384 | m_ActiveRequests.Remove(cacheKey); | 416 | m_ActiveRequests.Remove(cacheKey); |
385 | |||
386 | return (List<GroupMembersData>)members; | ||
387 | } | 417 | } |
388 | } | 418 | } |
389 | else | 419 | else |
@@ -498,16 +528,22 @@ namespace OpenSim.Groups | |||
498 | 528 | ||
499 | if (firstCall) | 529 | if (firstCall) |
500 | { | 530 | { |
501 | roles = d(); | 531 | try |
502 | if (roles != null) | ||
503 | { | 532 | { |
504 | lock (m_Cache) | 533 | roles = d(); |
534 | if (roles != null) | ||
505 | { | 535 | { |
506 | m_Cache.AddOrUpdate(cacheKey, roles, GROUPS_CACHE_TIMEOUT); | 536 | lock (m_Cache) |
507 | m_ActiveRequests.Remove(cacheKey); | 537 | { |
508 | return (List<GroupRolesData>)roles; | 538 | m_Cache.AddOrUpdate(cacheKey, roles, GROUPS_CACHE_TIMEOUT); |
539 | return (List<GroupRolesData>)roles; | ||
540 | } | ||
509 | } | 541 | } |
510 | } | 542 | } |
543 | finally | ||
544 | { | ||
545 | m_ActiveRequests.Remove(cacheKey); | ||
546 | } | ||
511 | } | 547 | } |
512 | else | 548 | else |
513 | Thread.Sleep(50); | 549 | Thread.Sleep(50); |
@@ -542,23 +578,29 @@ namespace OpenSim.Groups | |||
542 | 578 | ||
543 | if (firstCall) | 579 | if (firstCall) |
544 | { | 580 | { |
545 | List<ExtendedGroupRoleMembersData> _rmembers = d(); | 581 | try |
582 | { | ||
583 | List<ExtendedGroupRoleMembersData> _rmembers = d(); | ||
546 | 584 | ||
547 | if (_rmembers != null && _rmembers.Count > 0) | 585 | if (_rmembers != null && _rmembers.Count > 0) |
548 | rmembers = _rmembers.ConvertAll<GroupRoleMembersData>(new Converter<ExtendedGroupRoleMembersData, GroupRoleMembersData>(m_ForeignImporter.ConvertGroupRoleMembersData)); | 586 | rmembers = _rmembers.ConvertAll<GroupRoleMembersData>(new Converter<ExtendedGroupRoleMembersData, GroupRoleMembersData>(m_ForeignImporter.ConvertGroupRoleMembersData)); |
549 | else | 587 | else |
550 | rmembers = new List<GroupRoleMembersData>(); | 588 | rmembers = new List<GroupRoleMembersData>(); |
551 | 589 | ||
552 | lock (m_Cache) | 590 | lock (m_Cache) |
591 | { | ||
592 | // For some strange reason, when I cache the list of GroupRoleMembersData, | ||
593 | // it gets emptied out. The TryGet gets an empty list... | ||
594 | //m_Cache.AddOrUpdate(cacheKey, rmembers, GROUPS_CACHE_TIMEOUT); | ||
595 | // Caching the list of ExtendedGroupRoleMembersData doesn't show that issue | ||
596 | // I don't get it. | ||
597 | m_Cache.AddOrUpdate(cacheKey, _rmembers, GROUPS_CACHE_TIMEOUT); | ||
598 | return (List<GroupRoleMembersData>)rmembers; | ||
599 | } | ||
600 | } | ||
601 | finally | ||
553 | { | 602 | { |
554 | // For some strange reason, when I cache the list of GroupRoleMembersData, | ||
555 | // it gets emptied out. The TryGet gets an empty list... | ||
556 | //m_Cache.AddOrUpdate(cacheKey, rmembers, GROUPS_CACHE_TIMEOUT); | ||
557 | // Caching the list of ExtendedGroupRoleMembersData doesn't show that issue | ||
558 | // I don't get it. | ||
559 | m_Cache.AddOrUpdate(cacheKey, _rmembers, GROUPS_CACHE_TIMEOUT); | ||
560 | m_ActiveRequests.Remove(cacheKey); | 603 | m_ActiveRequests.Remove(cacheKey); |
561 | return (List<GroupRoleMembersData>)rmembers; | ||
562 | } | 604 | } |
563 | } | 605 | } |
564 | else | 606 | else |
@@ -667,12 +709,19 @@ namespace OpenSim.Groups | |||
667 | 709 | ||
668 | if (firstCall) | 710 | if (firstCall) |
669 | { | 711 | { |
670 | roles = d(); | 712 | try |
671 | lock (m_Cache) | 713 | { |
714 | roles = d(); | ||
715 | lock (m_Cache) | ||
716 | { | ||
717 | m_Cache.AddOrUpdate(cacheKey, roles, GROUPS_CACHE_TIMEOUT); | ||
718 | m_ActiveRequests.Remove(cacheKey); | ||
719 | return (List<GroupRolesData>)roles; | ||
720 | } | ||
721 | } | ||
722 | finally | ||
672 | { | 723 | { |
673 | m_Cache.AddOrUpdate(cacheKey, roles, GROUPS_CACHE_TIMEOUT); | ||
674 | m_ActiveRequests.Remove(cacheKey); | 724 | m_ActiveRequests.Remove(cacheKey); |
675 | return (List<GroupRolesData>)roles; | ||
676 | } | 725 | } |
677 | } | 726 | } |
678 | else | 727 | else |
@@ -768,13 +817,19 @@ namespace OpenSim.Groups | |||
768 | 817 | ||
769 | if (firstCall) | 818 | if (firstCall) |
770 | { | 819 | { |
771 | GroupNoticeInfo _notice = d(); | 820 | try |
821 | { | ||
822 | GroupNoticeInfo _notice = d(); | ||
772 | 823 | ||
773 | lock (m_Cache) | 824 | lock (m_Cache) |
825 | { | ||
826 | m_Cache.AddOrUpdate(cacheKey, _notice, GROUPS_CACHE_TIMEOUT); | ||
827 | return _notice; | ||
828 | } | ||
829 | } | ||
830 | finally | ||
774 | { | 831 | { |
775 | m_Cache.AddOrUpdate(cacheKey, _notice, GROUPS_CACHE_TIMEOUT); | ||
776 | m_ActiveRequests.Remove(cacheKey); | 832 | m_ActiveRequests.Remove(cacheKey); |
777 | return _notice; | ||
778 | } | 833 | } |
779 | } | 834 | } |
780 | else | 835 | else |
@@ -810,20 +865,24 @@ namespace OpenSim.Groups | |||
810 | 865 | ||
811 | if (firstCall) | 866 | if (firstCall) |
812 | { | 867 | { |
813 | notices = d(); | 868 | try |
869 | { | ||
870 | notices = d(); | ||
814 | 871 | ||
815 | lock (m_Cache) | 872 | lock (m_Cache) |
873 | { | ||
874 | m_Cache.AddOrUpdate(cacheKey, notices, GROUPS_CACHE_TIMEOUT); | ||
875 | return (List<ExtendedGroupNoticeData>)notices; | ||
876 | } | ||
877 | } | ||
878 | finally | ||
816 | { | 879 | { |
817 | m_Cache.AddOrUpdate(cacheKey, notices, GROUPS_CACHE_TIMEOUT); | ||
818 | m_ActiveRequests.Remove(cacheKey); | 880 | m_ActiveRequests.Remove(cacheKey); |
819 | return (List<ExtendedGroupNoticeData>)notices; | ||
820 | } | 881 | } |
821 | } | 882 | } |
822 | else | 883 | else |
823 | Thread.Sleep(50); | 884 | Thread.Sleep(50); |
824 | } | 885 | } |
825 | } | 886 | } |
826 | |||
827 | |||
828 | } | 887 | } |
829 | } | 888 | } \ No newline at end of file |