From b931f393a8255ede47ee37b43e318e817ed6de4f Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 9 Jun 2015 13:21:41 -0700 Subject: Avoid registering console commands in every single instance of GridUserService running on the same process. Only one registers them now. --- .../Services/UserAccountService/GridUserService.cs | 38 +++++++++++++--------- 1 file changed, 22 insertions(+), 16 deletions(-) (limited to 'OpenSim/Services') diff --git a/OpenSim/Services/UserAccountService/GridUserService.cs b/OpenSim/Services/UserAccountService/GridUserService.cs index 5aa2078..e4bcf15 100644 --- a/OpenSim/Services/UserAccountService/GridUserService.cs +++ b/OpenSim/Services/UserAccountService/GridUserService.cs @@ -43,27 +43,33 @@ namespace OpenSim.Services.UserAccountService public class GridUserService : GridUserServiceBase, IGridUserService { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private static bool m_Initialized; public GridUserService(IConfigSource config) : base(config) { m_log.Debug("[GRID USER SERVICE]: Starting user grid service"); - MainConsole.Instance.Commands.AddCommand( - "Users", false, - "show grid user", - "show grid user ", - "Show grid user entry or entries that match or start with the given ID. This will normally be a UUID.", - "This is for debug purposes to see what data is found for a particular user id.", - HandleShowGridUser); - - MainConsole.Instance.Commands.AddCommand( - "Users", false, - "show grid users online", - "show grid users online", - "Show number of grid users registered as online.", - "This number may not be accurate as a region may crash or not be cleanly shutdown and leave grid users shown as online\n." - + "For this reason, users online for more than 5 days are not currently counted", - HandleShowGridUsersOnline); + if (!m_Initialized) + { + m_Initialized = true; + + MainConsole.Instance.Commands.AddCommand( + "Users", false, + "show grid user", + "show grid user ", + "Show grid user entry or entries that match or start with the given ID. This will normally be a UUID.", + "This is for debug purposes to see what data is found for a particular user id.", + HandleShowGridUser); + + MainConsole.Instance.Commands.AddCommand( + "Users", false, + "show grid users online", + "show grid users online", + "Show number of grid users registered as online.", + "This number may not be accurate as a region may crash or not be cleanly shutdown and leave grid users shown as online\n." + + "For this reason, users online for more than 5 days are not currently counted", + HandleShowGridUsersOnline); + } } protected void HandleShowGridUser(string module, string[] cmdparams) -- cgit v1.1