From 1337f5f26e628dc7c5d038ffee5e957d95a72566 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 13 Aug 2016 23:41:57 +0100 Subject: [PATCH] remove a parameter for detection of grid fail to suport getting multiple user accounts per call and handle it where needed. --- .../LocalUserAccountServiceConnector.cs | 4 ++-- .../RemoteUserAccountServiceConnector.cs | 8 +++---- .../SimianUserAccountServiceConnector.cs | 3 +-- .../UserAccountServicesConnector.cs | 22 ++++++++++++++++++- .../HypergridService/UserAccountCache.cs | 3 +-- .../Interfaces/IUserAccountService.cs | 2 +- .../UserAccountService/UserAccountService.cs | 4 ++-- 7 files changed, 31 insertions(+), 15 deletions(-) diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs index 1002b8570b..1bb470477c 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs @@ -182,9 +182,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts return UserAccountService.GetUserAccount(scopeID, Email); } - public List GetUserAccounts(UUID scopeID, List IDs, out bool suported) + public List GetUserAccounts(UUID scopeID, List IDs) { - return UserAccountService.GetUserAccounts(scopeID, IDs, out suported); + return UserAccountService.GetUserAccounts(scopeID, IDs); } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs index fb5fae10b1..ce1754f6b1 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs @@ -160,9 +160,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts return account; } - public override List GetUserAccounts(UUID scopeID, List IDs, out bool suported) + public override List GetUserAccounts(UUID scopeID, List IDs) { - suported = true; List accs = new List(); List missing = new List(); @@ -184,15 +183,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts if(missing.Count > 0) { - List ext = base.GetUserAccounts(scopeID, missing, out suported); - if(suported && ext != null) + List ext = base.GetUserAccounts(scopeID, missing); + if(ext != null) accs.AddRange(ext); } return accs; } - public override bool StoreUserAccount(UserAccount data) { // This remote connector refuses to serve this method diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs index 1ef5ad26c6..6f613c1f5d 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs @@ -201,9 +201,8 @@ namespace OpenSim.Services.Connectors.SimianGrid return null; } - public List GetUserAccounts(UUID scopeID, List IDs, out bool suported) + public List GetUserAccounts(UUID scopeID, List IDs) { - suported = false; return null; } diff --git a/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs b/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs index e6251431e9..5bc7a1cf80 100644 --- a/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs +++ b/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs @@ -191,7 +191,27 @@ namespace OpenSim.Services.Connectors return accounts; } - public virtual List GetUserAccounts(UUID scopeID, List IDs, out bool suported) + public virtual List GetUserAccounts(UUID scopeID, List IDs) + { + List accs = new List(); + bool multisuported = true; + accs = doGetMultiUserAccounts(scopeID, IDs, out multisuported); + if(multisuported) + return accs; + + // service does not do multi accounts so need to do it one by one + + UUID uuid = UUID.Zero; + foreach(string id in IDs) + { + if(UUID.TryParse(id, out uuid) && uuid != UUID.Zero) + accs.Add(GetUserAccount(scopeID,uuid)); + } + + return accs; + } + + private List doGetMultiUserAccounts(UUID scopeID, List IDs, out bool suported) { suported = true; Dictionary sendData = new Dictionary(); diff --git a/OpenSim/Services/HypergridService/UserAccountCache.cs b/OpenSim/Services/HypergridService/UserAccountCache.cs index 618bd97d8c..25ffb63548 100644 --- a/OpenSim/Services/HypergridService/UserAccountCache.cs +++ b/OpenSim/Services/HypergridService/UserAccountCache.cs @@ -100,9 +100,8 @@ namespace OpenSim.Services.HypergridService return null; } - public List GetUserAccounts(UUID scopeID, List IDs, out bool suported) + public List GetUserAccounts(UUID scopeID, List IDs) { - suported = false; return null; } diff --git a/OpenSim/Services/Interfaces/IUserAccountService.cs b/OpenSim/Services/Interfaces/IUserAccountService.cs index 19140406d2..c6f3ef35b0 100644 --- a/OpenSim/Services/Interfaces/IUserAccountService.cs +++ b/OpenSim/Services/Interfaces/IUserAccountService.cs @@ -187,7 +187,7 @@ namespace OpenSim.Services.Interfaces /// List GetUserAccounts(UUID scopeID, string query); List GetUserAccountsWhere(UUID scopeID, string where); - List GetUserAccounts(UUID scopeID, List IDs, out bool suported); + List GetUserAccounts(UUID scopeID, List IDs); /// /// Store the data given, wich replaces the stored data, therefore must be complete. diff --git a/OpenSim/Services/UserAccountService/UserAccountService.cs b/OpenSim/Services/UserAccountService/UserAccountService.cs index fbe5e3b68e..668fe53730 100644 --- a/OpenSim/Services/UserAccountService/UserAccountService.cs +++ b/OpenSim/Services/UserAccountService/UserAccountService.cs @@ -265,9 +265,9 @@ namespace OpenSim.Services.UserAccountService return MakeUserAccount(d[0]); } - public List GetUserAccounts(UUID scopeID, List IDs, out bool suported) + public List GetUserAccounts(UUID scopeID, List IDs) { - suported = true; + // do it one at a time db access should be fast, so no need to break its api List accs = new List(); UUID uuid = UUID.Zero; foreach(string id in IDs)