Stagger multiple bot logins by 5 seconds to make this part of the test more 'realistic'

TODO: Need to make this value configurable by a command line parameter to pCampbot
0.7.4.1
Justin Clark-Casey (justincc) 2012-05-11 02:05:32 +01:00
parent 0ddf3c5289
commit 9c392f6a68
1 changed files with 13 additions and 0 deletions

View File

@ -49,6 +49,14 @@ namespace pCampBot
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public const int DefaultLoginDelay = 5000;
/// <summary>
/// Delay between logins of multiple bots.
/// </summary>
/// <remarks>TODO: This value needs to be configurable by a command line argument.</remarks>
public int LoginDelay { get; set; }
/// <summary> /// <summary>
/// Command console /// Command console
/// </summary> /// </summary>
@ -84,6 +92,8 @@ namespace pCampBot
/// </summary> /// </summary>
public BotManager() public BotManager()
{ {
LoginDelay = DefaultLoginDelay;
Rng = new Random(Environment.TickCount); Rng = new Random(Environment.TickCount);
AssetsReceived = new Dictionary<UUID, bool>(); AssetsReceived = new Dictionary<UUID, bool>();
RegionsKnown = new Dictionary<ulong, GridRegion>(); RegionsKnown = new Dictionary<ulong, GridRegion>();
@ -224,6 +234,9 @@ namespace pCampBot
pbThread.IsBackground = true; pbThread.IsBackground = true;
pbThread.Start(); pbThread.Start();
// Stagger logins
Thread.Sleep(LoginDelay);
} }
/// <summary> /// <summary>