Avoid registering console commands in every single instance of GridUserService running on the same process. Only one registers them now.

fsassets
Diva Canto 2015-06-09 13:21:41 -07:00
parent 0c5facbd75
commit b931f393a8
1 changed files with 21 additions and 15 deletions

View File

@ -43,27 +43,33 @@ namespace OpenSim.Services.UserAccountService
public class GridUserService : GridUserServiceBase, IGridUserService public class GridUserService : GridUserServiceBase, IGridUserService
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private static bool m_Initialized;
public GridUserService(IConfigSource config) : base(config) public GridUserService(IConfigSource config) : base(config)
{ {
m_log.Debug("[GRID USER SERVICE]: Starting user grid service"); m_log.Debug("[GRID USER SERVICE]: Starting user grid service");
MainConsole.Instance.Commands.AddCommand( if (!m_Initialized)
"Users", false, {
"show grid user", m_Initialized = true;
"show grid user <ID>",
"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( MainConsole.Instance.Commands.AddCommand(
"Users", false, "Users", false,
"show grid users online", "show grid user",
"show grid users online", "show grid user <ID>",
"Show number of grid users registered as online.", "Show grid user entry or entries that match or start with the given ID. This will normally be a UUID.",
"This number may not be accurate as a region may crash or not be cleanly shutdown and leave grid users shown as online\n." "This is for debug purposes to see what data is found for a particular user id.",
+ "For this reason, users online for more than 5 days are not currently counted", HandleShowGridUser);
HandleShowGridUsersOnline);
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) protected void HandleShowGridUser(string module, string[] cmdparams)