Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC][Cache] Limit number of locations we tag to not cripple performance #2399

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 20 additions & 0 deletions eZ/Publish/Core/Persistence/Cache/ContentHandler.php
Expand Up @@ -424,6 +424,26 @@ private function getCacheTags(ContentInfo $contentInfo, $withFields = false, arr

if ($contentInfo->mainLocationId) {
$locations = $this->persistenceHandler->locationHandler()->loadLocationsByContent($contentInfo->id);
$locationCount = count($locations);
if ($locationCount > 30) {
// As we don't have paging support on loadLocationsByContent(), slice it to avoid overloading tag system
$locations = array_slice(
$locations,
0,
25
);
// TODO: Will this contain main location? if not, somehow make sure of it in SE or here
@trigger_error(
sprintf(
'%d locations for content %d, not able to handle that many tags so took the first 25!',
$locationCount,
$contentInfo->id
),
E_USER_WARNING
);

}

foreach ($locations as $location) {
$tags[] = 'location-' . $location->id;
foreach (explode('/', trim($location->pathString, '/')) as $pathId) {
Expand Down