Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Core/AuctionHouse): rework auction house #17644

Closed

Conversation

Winfidonarleyan
Copy link
Member

@Winfidonarleyan Winfidonarleyan commented Nov 5, 2023

Continue #15334

Changes Proposed:

  • Full remove old async auction
  • Implement new async auction with ProducerConsumerQueue
  • Add support all auction packets to new packet system
  • Add to async handle CMSG_AUCTION_SELL_ITEM
  • Add to async handle CMSG_AUCTION_PLACE_BID
  • Add to async handle CMSG_AUCTION_LIST_BIDDER_ITEMS
  • Add new config option for set threads count Auction.Async.Threads

Issues Addressed:

  • Closes

SOURCE:

Tests Performed:

This PR has been:

  • Tested in-game by the author.
  • Tested in-game by other community members/someone else other than the author/has been live on production servers.
  • This pull request requires further testing and may have edge cases to be tested.

How to Test the Changes:

TODO testing:

  • Open auction house general window
  • Search all items
  • Searching for a specific item via category
  • Searching for a specific item via uniqueue name
  • Buying items
  • Bid single item
  • Bid multiple items
  • Sale of a single item
  • Selling multiple items
  • Check mails (Buying/Selling/Bids)
  • Check config option Auction.Async.Threads
  • Testing with 20k+ items
  • Testing with real playes

Known Issues and TODO List:

How to Test AzerothCore PRs

When a PR is ready to be tested, it will be marked as [WAITING TO BE TESTED].

You can help by testing PRs and writing your feedback here on the PR's page on GitHub. Follow the instructions here:

http://www.azerothcore.org/wiki/How-to-test-a-PR

REMEMBER: when testing a PR that changes something generic (i.e. a part of code that handles more than one specific thing), the tester should not only check that the PR does its job (e.g. fixing spell XXX) but especially check that the PR does not cause any regression (i.e. introducing new bugs).

For example: if a PR fixes spell X by changing a part of code that handles spells X, Y, and Z, we should not only test X, but we should test Y and Z as well.

@github-actions github-actions bot added CORE Related to the core file-cpp Used to trigger the matrix build labels Nov 5, 2023
@kjack9
Copy link
Contributor

kjack9 commented Nov 5, 2023

Hi @Winfidonarleyan , looks like a ton of work went into this! Is there anything in specific we should test as far as functionality, features, or differences in performances between master and this PR? I don't necessarily have the C++ chops to review all your changes, but I'd be happy to put some time into testing with my fairly-large (25k items) AH.

EDIT: I see this is still a draft, let us know if it's not quite ready for testing yet.

@Winfidonarleyan
Copy link
Member Author

Hi @Winfidonarleyan , looks like a ton of work went into this! Is there anything in specific we should test as far as functionality, features, or differences in performances between master and this PR? I don't necessarily have the C++ chops to review all your changes, but I'd be happy to put some time into testing with my fairly-large (25k items) AH.

EDIT: I see this is still a draft, let us know if it's not quite ready for testing yet.

I will prepare the PR and let you know what you need to test

@Winfidonarleyan
Copy link
Member Author

@kjack9 Done, You can take a look, if there's anything you don't understand, ask away

@Winfidonarleyan Winfidonarleyan marked this pull request as ready for review November 5, 2023 07:14
thread.join();
}

/*static*/ AsyncAuctionMgr* AsyncAuctionMgr::instance()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why comment it? If not used as static we can just delete it?


if (_packet->Bid > MAX_MONEY_AMOUNT || _packet->Buyout > MAX_MONEY_AMOUNT)
{
LOG_ERROR("network", "WORLD: HandleAuctionSellItem - Player {} ({}) attempted to sell item with higher price than max gold amount.", player->GetName(), player->GetGUID().ToString());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this really be classed as network? Why dont we combine all auctionhouse related messages into an auctionhouse logger?


if (listItems->GetAll || (listItems->IsNoFilter() && packet.WSearchedName.empty()))
{
ForEachAuctions([&packet](AuctionEntry* auction)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was working on improving this, and added a AuctionShortlist.reserve() here.
Because we know how many auctions we have, we can reserve beforehand to save a bit of allocation time

@Kitzunu
Copy link
Member

Kitzunu commented Nov 11, 2023

Conflict

@Kitzunu
Copy link
Member

Kitzunu commented Nov 12, 2023

@azerothcore/testers A good PR that needs testing

@heyitsbench
Copy link
Contributor

@Winfidonarleyan, can you confirm if this PR resolves #5068?

@Winfidonarleyan
Copy link
Member Author

@Winfidonarleyan, can you confirm if this PR resolves #5068?

Yes

Copy link
Contributor

@walkline walkline left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like aync operations are thread unsafe.

if (!player)
return;

auto session{ player->GetSession() };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Winfidonarleyan It looks like async tasks are still thread unsafe.
If I understood correctly this task can be executed in parallel with a map update for example.
And if that is true, then you can't use player/session objects in several threads without synchronisation mechanisms (mutexes/locks/semaphores).
In your shoes I would try to copy all required player/session related data into a new object(s) during enqueueing/scheduling a task. And use this new object inside of these tasks instead of real player/session objects.

@Kitzunu
Copy link
Member

Kitzunu commented Nov 24, 2023

conflicts

@Kitzunu
Copy link
Member

Kitzunu commented Jun 26, 2024

abandoned

@Kitzunu Kitzunu closed this Jun 26, 2024
@Kitzunu Kitzunu added the PR Abandoned Original author stopped working on this PR. Feel free to take over. label Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CORE Related to the core file-cpp Used to trigger the matrix build PR Abandoned Original author stopped working on this PR. Feel free to take over. Waiting to be Tested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants