Skip to content

Remove intermediate SaveToDB calls in PlayerbotFactory::Randomize#366

Draft
Copilot wants to merge 1 commit into
masterfrom
copilot/fix-shard-key-in-player-deletefromdb
Draft

Remove intermediate SaveToDB calls in PlayerbotFactory::Randomize#366
Copilot wants to merge 1 commit into
masterfrom
copilot/fix-shard-key-in-player-deletefromdb

Conversation

Copilot AI commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Follow-up to the async DB write-sharding series. PlayerbotFactory::Randomize was flushing to DB three times mid-randomize before the final save, unnecessarily serializing shard writes and providing no durability value (bots re-randomize from scratch on restart anyway).

Changes

  • src/modules/Bots/playerbot/PlayerbotFactory.cpp — removed three intermediate bot->SaveToDB() calls inside Randomize(bool incremental): after the reset phase, after quest init, and after trade skill update. The single final save (after all initialization — quests, spells, skills, equipment, pet, money) is retained. Count per Randomize invocation: 4 → 1.

Blocked: Change 1 — Player::DeleteFromDB shard key

BeginTransaction(lowguid) at Player.cpp:5207 requires a BeginTransaction(uint32 shardKey) overload that does not exist in this repo — commits 6b63ea2 / 4d0901b (the GUID-shard dispatch layer) are absent from this tree. Applying the call produces:

Player.cpp:5207: error: no matching function for call to
  'DatabaseMysql::BeginTransaction(uint32&)'

Change 1 is deferred until the sharding infrastructure in src/shared/Database/ is landed.


This change is Reviewable

Copilot AI requested review from Copilot and removed request for Copilot June 12, 2026 19:26
Copilot AI changed the title Coalesce SaveToDB calls in PlayerbotFactory::Randomize (Change 2 of async DB write-sharding follow-up) Remove intermediate SaveToDB calls in PlayerbotFactory::Randomize Jun 12, 2026
Copilot AI requested a review from billy1arm June 12, 2026 19:27
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 duplication

Metric Results
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@AppVeyorBot

Copy link
Copy Markdown

Build Mangos ZERO Server 22.04.330-ntbigniq completed (commit 6ba524ad99 by @Copilot)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants