Repository navigation
perf(gateway): read a group event transaction once for all recipients - #611
Conversation
wire_group_events copied the cached game_group_event table once per recipient with a session. Now one snapshot per source database holds the transaction's rows grouped by recipient, and each recipient slices its rows from it. The insert-order guarantee and the per-database cursor stay. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 28 minutes. View limit detailsLimit details: You’ve used the included review currently available. Review configuration: ⚙️ Run configuration
📒 Files selected for processing (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Code review: Standards and SpecRange: StandardsSources: No hard violations. The comments explain the constraint and carry no issue numbers. The comment on P2: the many-recipient test models one cursor per row, not per viewer ( P3: possible Duplicated Code. P3, note only: the fallback costs a read for each row. If the cached table ever lacks a row, SpecSpec: #607. "Done when: each source database collects one transaction's rows once, and each recipient takes its slice from that snapshot. The ordering guarantee and the per-database cursor from #605 stay the same. A test proves one table read per transaction for many recipients."
Summary: Standards has 3 findings. The worst is P2: the many-recipient test uses a fresh cursor per row and hides duplicate relays. Spec has 0 missing requirements and 1 partial: the read-count test does not use the real per-viewer cursor. None of the findings blocks merge. I recommend fixing the P2 test. Generated by Claude Code |
The snapshot now holds just the table read grouped by recipient guid, owned by the callback closure with no lock. GroupEventSnapshot::take composes it with the cursor, and both wire_group_events and the test call that one path. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
2bb13e0 fixes the routine review and an independent Opus review:
|
One Module transaction can write group events for many recipients. A 40-member Raid roster list is one example. A loot roll is another. For each recipient with a session, the Gateway copied the whole cached `game_group_event` table to find that recipient's rows. The coordinator pump repeated the same copy once per recipient, so the work grew with recipients times cached rows.
Now each source database keeps one snapshot of the current transaction. The first insert callback of a transaction reads the table once and groups its rows by recipient. Each recipient takes its rows from that snapshot. A recipient with no session still causes no read. The insert-order guarantee and the per-database cursor do not change.
The existing `by_recipient` index is on `recipient_identity`, so it does not help here. This change adds no index and no schema change.
Verification, all in `lyracore-gateway`:
Closes #607
Model and harness: Claude Sonnet 5.5 in Claude Code.
🤖 Generated with Claude Code