mirror of
https://github.com/NathanHandley/mod-ah-bot-plus.git
synced 2026-01-13 01:08:37 +00:00
Merge pull request #27 from zeb139/addNewAuctions-performance-improvement
Performance: Added batch processing to AddNewAuctions()
This commit is contained in:
@@ -37,11 +37,8 @@
|
||||
#
|
||||
# AuctionHouseBot.ItemsPerCycle
|
||||
# How many items to post on the auction house every house update. Items
|
||||
# in a cycle will be posted by a single randomly selected bot, so Keep
|
||||
# this value low if you want highly diverse postings. Do note that
|
||||
# this value has a direct impact on login startup time (specifically time
|
||||
# from startup complete to first character being able to log in) so a
|
||||
# value greater than a few hundred is not recommended.
|
||||
# in a cycle will be posted by a single randomly selected bot, so keep
|
||||
# this value low if you want highly diverse "Seller" names in auction listings.
|
||||
# Default 150
|
||||
#
|
||||
# AuctionHouseBot.ListingExpireTimeInSecondsMin
|
||||
|
||||
@@ -883,6 +883,11 @@ void AuctionHouseBot::AddNewAuctions(Player* AHBplayer, FactionSpecificAuctionHo
|
||||
// only insert a few at a time, so as not to peg the processor
|
||||
uint32 itemsGenerated = 0;
|
||||
for (uint32 cnt = 1; cnt <= newItemsToListCount; cnt++)
|
||||
{
|
||||
auto trans = CharacterDatabase.BeginTransaction();
|
||||
uint32 batchCount = 0;
|
||||
|
||||
while (batchCount < 500 && itemsGenerated < newItemsToListCount)
|
||||
{
|
||||
// Either generate a new item ID to list, or grab from the remaining list
|
||||
uint32 itemID;
|
||||
@@ -949,7 +954,6 @@ void AuctionHouseBot::AddNewAuctions(Player* AHBplayer, FactionSpecificAuctionHo
|
||||
|
||||
uint32 dep = sAuctionMgr->GetAuctionDeposit(ahEntry, etime, item, stackCount);
|
||||
|
||||
auto trans = CharacterDatabase.BeginTransaction();
|
||||
AuctionEntry* auctionEntry = new AuctionEntry();
|
||||
auctionEntry->Id = sObjectMgr->GenerateAuctionID();
|
||||
auctionEntry->houseId = AuctionHouseId(config->GetAHID());
|
||||
@@ -968,8 +972,11 @@ void AuctionHouseBot::AddNewAuctions(Player* AHBplayer, FactionSpecificAuctionHo
|
||||
sAuctionMgr->AddAItem(item);
|
||||
auctionHouse->AddAuction(auctionEntry);
|
||||
auctionEntry->SaveToDB(trans);
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
itemsGenerated++;
|
||||
batchCount++;
|
||||
}
|
||||
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
}
|
||||
if (debug_Out)
|
||||
LOG_INFO("module", "AHSeller: Added {} items", itemsGenerated);
|
||||
|
||||
Reference in New Issue
Block a user