Skip to content

fix(online): 拆解 CommitAsync 降低认知复杂度 - #547

Merged
AlianBlank merged 1 commit into
mainfrom
feature/auto-server-source-worker-run-10130-20261012T1620
Oct 13, 2026
Merged

AlianBlank merged 1 commit into
mainfrom
feature/auto-server-source-worker-run-10130-20261012T1620

Conversation

@AlianBlank

@AlianBlank AlianBlank commented Oct 12, 2026 •

Copy link
Copy Markdown
Collaborator

Linear: GFX-891

Summary by CodeRabbit

  • Refactor
    • 调整了匹配成功后的事件处理流程;分配创建和匹配状态更新的发布行为保持不变。未查询到的票据仍会跳过。

消除 SonarCloud S3776(CRITICAL):OnlineMatchmakerCoordinator.CommitAsync
认知复杂度 17 超阈值 15。拆出三个私有方法承载原内联段落:双 foreach 收集
(CollectTicketIdsAndPlayers)、assignment 事件发布
(PublishAssignmentCreatedAsync)、逐票据 ticket-changed 事件循环
(PublishMatchedTicketEventsAsync),主方法收敛后复杂度 1,拆出方法
3/3/10。纯等价重构:公共 API、事件 await 序与实参、return null 竞态
语义逐字不变。

Linear: GFX-891
@coderabbitai

coderabbitai Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a5be02da-7c58-44bb-a0c6-e39aeb67c175

📥 Commits

Reviewing files that changed from the base of the PR and between 1e2fb11 and 5f1603f.


📒 Files selected for processing (1)
  • GameFrameX.Online/Matchmaking/OnlineMatchmakerCoordinator.cs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.



📝 Walkthrough

Walkthrough

CommitAsync 将票据与玩家信息收集逻辑提取到私有辅助方法。提交成功后,协调器通过辅助方法发布分配创建事件和匹配状态变更事件。票据收集行为及事件发布顺序保持不变。

Changes

匹配提交流程

层 / 文件 摘要
提交数据收集与事件发布
GameFrameX.Online/Matchmaking/OnlineMatchmakerCoordinator.cs
CommitAsync 调用 CollectTicketIdsAndPlayers 收集票据 ID 和去重后的玩家 ID。提交成功后,调用辅助方法发布分配创建事件,并按票据 ID 查询和发布匹配状态变更事件;未查询到的票据不发布事件。移除重复的 return committed。

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Refactor


Merge Risk: ⚪ Minimal · up to 5f160

No merge-blocking issue is identified; the coordinator refactor appears mergeable after normal checks.

Pre-merge checks | Passed 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed 标题准确概括了主要变更。该 PR 拆分了 CommitAsync 的内部逻辑,并降低了认知复杂度。
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 1 files.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.

✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR

🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sonarqubecloud

Copy link
Copy Markdown

@AlianBlank
AlianBlank merged commit 5a4002c into main Oct 13, 2026
3 checks passed
@AlianBlank
AlianBlank deleted the feature/auto-server-source-worker-run-10130-20261012T1620 branch October 13, 2026 02:52
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