Skip to content

Chunk ScanAllFactions main loop + toc 120005#13

Open
mcc1 wants to merge 2 commits into
Thaoky:mainfrom
mcc1:12.0-chunk-factions
Open

Chunk ScanAllFactions main loop + toc 120005#13
mcc1 wants to merge 2 commits into
Thaoky:mainfrom
mcc1:12.0-chunk-factions

Conversation

@mcc1
Copy link
Copy Markdown

@mcc1 mcc1 commented Apr 25, 2026

Summary

  • 12.0 retail has 400+ factions when SaveHeaders expands all categories. ScanSingleFaction makes 4-5 API calls per entry. The synchronous loop blows WoW's "script ran too long" budget on PLAYER_ALIVE.
  • Chunk the main loop into 60 factions per frame, yielding via C_Timer.After(0, ...). RestoreHeaders + lastUpdate run after the last chunk completes (they need to bracket the chunked walk because of header state).
  • Generation counter cancels in-flight chunked passes when a fresh ScanAllFactions starts.
  • Declare 12.0.5 in toc.

Notes

  • The existing 3s debounce in OnUpdateFaction is preserved unchanged - this PR addresses the underlying scan cost, not the trigger frequency.
  • ScanGuildReputation is left synchronous (single faction match in a tight loop, cheap).

Test plan

  • Log in fresh on 12.0.5 - no script ran too long from DataStore_Reputations.
  • After ~1s, /dump DataStore:GetReputationInfo("char", factionID) returns expected data across all categories (including Khaz Algar / Midnight factions previously dropped mid-scan).
  • Trigger a rep change via mob kill - debounce + chunked rescan completes cleanly.

🤖 Generated with Claude Code

mcc1 and others added 2 commits April 26, 2026 02:48
12.0 introduces a much larger faction list (400+ when SaveHeaders
expands every category), and ScanSingleFaction makes 4-5 C_Reputation
/ C_GossipInfo API calls per faction. The synchronous loop blows the
"script ran too long" budget on PLAYER_ALIVE.

Process 60 factions per frame, then yield via C_Timer.After(0, ...).
RestoreHeaders runs once the chunked walk finishes - it cannot be
reordered because it needs the header counter that SaveHeaders set
up. A generation counter lets a fresh ScanAllFactions cleanly
supersede any in-flight chunked pass instead of running concurrently
with it.

The existing 3s debounce in OnUpdateFaction is preserved.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant