ブログの記事数やカテゴリ数が多い場合に、カテゴリ一覧ウィジェットを使用するとメモリオーバーエラーになる#4420
Open
seto1 wants to merge 3 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
カテゴリ数・記事数が多い環境で「カテゴリ一覧ウィジェット」がメモリオーバーや極端な遅延を起こす問題に対応するため、カテゴリ取得時の関連データ読み込みを削減し、カテゴリ別記事数の取得方法を集計クエリ中心に見直すPRです。
Changes:
BlogCategoriesTable::_getCategoryList()のcontain(['BlogPosts' => ...])を削除し、カテゴリ一覧取得時のメモリ消費を抑制- カテゴリ別記事数をカテゴリごとに都度 count する方式から、1回の集計クエリ+アプリ側での合算に変更
- 記事数集計用の
getCategoryPostCounts()を追加し、再帰呼び出し間で集計結果を使い回すように変更
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
ryuring
approved these changes
Jun 11, 2026
Collaborator
|
テストが失敗してるみたいですので、確認お願いします @seto1 |
Collaborator
|
@seto1 おそらく |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

メモリの問題は、BlogCategoriesTableの以下の行を削除することで解決しました。
ただ、それだけだとデータ量が多い場合に数十秒ほど処理時間がかかってしまうため、さらに以下の調整を行っています。
確認の際に使用したデータ量は以下です。
ご確認お願いします。