From 16ba8356c22fbaf52a07e0168a04e47aff677a0d Mon Sep 17 00:00:00 2001 From: Yunfan Li Date: Sun, 24 Dec 2023 15:51:08 +0800 Subject: [PATCH] Speed up bot creation --- src/RandomPlayerbotFactory.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/RandomPlayerbotFactory.cpp b/src/RandomPlayerbotFactory.cpp index 1c56bcd7..b88f2292 100644 --- a/src/RandomPlayerbotFactory.cpp +++ b/src/RandomPlayerbotFactory.cpp @@ -290,7 +290,7 @@ void RandomPlayerbotFactory::CreateRandomBots() CharacterDatabase.Execute("UPDATE playerbots_names SET in_use=0 WHERE in_use=1"); /* TODO(yunfan): we need to sleep here to wait for async account deleted, or the newly account won't be created correctly the better way is turning the async db operation to sync db operation */ - std::this_thread::sleep_for(100ms * sPlayerbotAIConfig->randomBotAccountCount); + std::this_thread::sleep_for(10ms * sPlayerbotAIConfig->randomBotAccountCount); LOG_INFO("playerbots", "Random bot characters deleted."); LOG_INFO("playerbots", "Please reset the AiPlayerbot.DeleteRandomBotAccounts to 0 and restart the server..."); World::StopNow(SHUTDOWN_EXIT_CODE); @@ -335,7 +335,7 @@ void RandomPlayerbotFactory::CreateRandomBots() if (account_creation) { /* wait for async accounts create to make character create correctly, same as account delete */ - std::this_thread::sleep_for(100ms * sPlayerbotAIConfig->randomBotAccountCount); + std::this_thread::sleep_for(10ms * sPlayerbotAIConfig->randomBotAccountCount); } LOG_INFO("playerbots", "Creating random bot characters..."); @@ -403,7 +403,7 @@ void RandomPlayerbotFactory::CreateRandomBots() if (bot_creation) { LOG_INFO("playerbots", "Waiting for {} characters loading into database...", totalCharCount); /* wait for characters load into database, or characters will fail to loggin */ - std::this_thread::sleep_for(15ms * totalCharCount); + std::this_thread::sleep_for(10s); } for (WorldSession* session : sessionBots)