perf(api): バッチ化・並列化で逐次クエリ/逐次 await を解消 - #1005
Conversation
タイトルリネーム伝播 (`propagateTitleRename`) の参照元ページ書き換えを、 最大 8 件 (`SOURCE_REWRITE_CONCURRENCY`) の `Promise.allSettled` バッチで 並列化する。各 source は独立した `page_contents` 行をロックするため順序 非依存で、ロック競合・デッドロックは発生しない。失敗は従来どおりベスト エフォートでカウント・ログし、後続 source / ghost 昇格を止めない。 AI モデル同期 (`syncOneProvider`) の新規モデル投入を、行ごとの逐次 INSERT から単一マルチバリュー INSERT に変更 (N+1 → 1 クエリ)。sortOrder は max+1 から index で事前採番する。表示順 (orderBy) にしか使わないため、稀な onConflict スキップで生じるギャップは無害。 並列パスの回帰防止テストを追加 (順序非依存の意味ベース DB モック): ベストエフォート集計・同時実行数 8 のバウンド検証。 Refs #1001
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughThis PR implements two independent performance optimizations: source-page rewrites in title-rename propagation now execute with bounded parallelism via chunked batching, and AI model insertion switches from per-row loops to single multi-value statements. Tests verify parallel failure tolerance and concurrency limits. ChangesTitle Rename Propagation with Bounded Parallelism
AI Model Batch Insert Optimization
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Code Review
This pull request optimizes AI model synchronization by batching inserts and parallelizes source page rewriting during title rename propagation in bounded batches. The feedback recommends reducing the concurrency limit from 8 to 4 to avoid database connection pool exhaustion and transaction propagation issues, along with updating the corresponding test suite to reflect this change.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
fire-and-forget な伝播では同時リネームで使用接続数が重畳する (N 件同時 → 最大 4N 接続)。DB プール上限 max:20 を枯渇させて 無関係な API を巻き込まないよう、保守的に 4 へ。バウンド検証テストも 4 ベース(チャンク 4/4/2)に更新。 レビュー指摘 (gemini-code-assist) への対応。 Refs #1001
タイトルリネーム伝播 (
propagateTitleRename) の参照元ページ書き換えを、最大 8 件 (
SOURCE_REWRITE_CONCURRENCY) のPromise.allSettledバッチで並列化する。各 source は独立した
page_contents行をロックするため順序非依存で、ロック競合・デッドロックは発生しない。失敗は従来どおりベスト
エフォートでカウント・ログし、後続 source / ghost 昇格を止めない。
AI モデル同期 (
syncOneProvider) の新規モデル投入を、行ごとの逐次 INSERTから単一マルチバリュー INSERT に変更 (N+1 → 1 クエリ)。sortOrder は max+1
から index で事前採番する。表示順 (orderBy) にしか使わないため、稀な
onConflict スキップで生じるギャップは無害。
並列パスの回帰防止テストを追加 (順序非依存の意味ベース DB モック):
ベストエフォート集計・同時実行数 8 のバウンド検証。
Refs #1001
Summary by CodeRabbit
Tests
Performance