summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorcatch <6915-catch@users.noreply.drupalcode.org>2025-03-20 08:50:50 +0000
committercatch <6915-catch@users.noreply.drupalcode.org>2025-03-20 08:50:50 +0000
commit407e764568023d6002b4cb53ed2d9a5a2be56d0a (patch)
tree4d89c6445332af23063b73f37386d2d4c9eac17a
parentcaf7dbc82daf3bf757ed35d16345c5fd5f887664 (diff)
downloaddrupal-407e764568023d6002b4cb53ed2d9a5a2be56d0a.tar.gz
drupal-407e764568023d6002b4cb53ed2d9a5a2be56d0a.zip
Issue #3504559 by berdir: AssetResolver may load the same cache several time on a single page with bigpipe
-rw-r--r--core/core.services.yml14
-rw-r--r--core/modules/navigation/tests/src/FunctionalJavascript/PerformanceTest.php4
-rw-r--r--core/profiles/demo_umami/tests/src/FunctionalJavascript/OpenTelemetryAuthenticatedPerformanceTest.php4
-rw-r--r--core/profiles/standard/tests/src/FunctionalJavascript/StandardPerformanceTest.php2
4 files changed, 18 insertions, 6 deletions
diff --git a/core/core.services.yml b/core/core.services.yml
index dfb5274960f..55d8d2ebc98 100644
--- a/core/core.services.yml
+++ b/core/core.services.yml
@@ -1710,9 +1710,21 @@ services:
class: Drupal\Core\Asset\LibraryDependencyResolver
arguments: ['@library.discovery']
Drupal\Core\Asset\LibraryDependencyResolverInterface: '@library.dependency_resolver'
+ # Set up a cache chain for asset caching as the same assets may be
+ # requested several times, non-public as they are not meant to be reused.
+ cache.asset_memory:
+ class: Drupal\Core\Cache\MemoryCache\MemoryCache
+ arguments: ['@datetime.time']
+ public: false
+ cache.asset_chain:
+ class: Drupal\Core\Cache\BackendChain
+ public: false
+ calls:
+ - [ appendBackend, [ '@cache.asset_memory' ] ]
+ - [ appendBackend, [ '@cache.data' ] ]
asset.resolver:
class: Drupal\Core\Asset\AssetResolver
- arguments: ['@library.discovery', '@library.dependency_resolver', '@module_handler', '@theme.manager', '@language_manager', '@cache.data', '@theme_handler']
+ arguments: ['@library.discovery', '@library.dependency_resolver', '@module_handler', '@theme.manager', '@language_manager', '@cache.asset_chain', '@theme_handler']
Drupal\Core\Asset\AssetResolverInterface: '@asset.resolver'
info_parser:
class: Drupal\Core\Extension\InfoParser
diff --git a/core/modules/navigation/tests/src/FunctionalJavascript/PerformanceTest.php b/core/modules/navigation/tests/src/FunctionalJavascript/PerformanceTest.php
index 1acfd62fb1d..7b50dbd0da7 100644
--- a/core/modules/navigation/tests/src/FunctionalJavascript/PerformanceTest.php
+++ b/core/modules/navigation/tests/src/FunctionalJavascript/PerformanceTest.php
@@ -73,10 +73,10 @@ class PerformanceTest extends PerformanceTestBase {
$expected = [
'QueryCount' => 4,
- 'CacheGetCount' => 59,
+ 'CacheGetCount' => 58,
'CacheGetCountByBin' => [
'config' => 11,
- 'data' => 6,
+ 'data' => 5,
'discovery' => 10,
'bootstrap' => 6,
'dynamic_page_cache' => 2,
diff --git a/core/profiles/demo_umami/tests/src/FunctionalJavascript/OpenTelemetryAuthenticatedPerformanceTest.php b/core/profiles/demo_umami/tests/src/FunctionalJavascript/OpenTelemetryAuthenticatedPerformanceTest.php
index 8e9241c7506..cccdaec2608 100644
--- a/core/profiles/demo_umami/tests/src/FunctionalJavascript/OpenTelemetryAuthenticatedPerformanceTest.php
+++ b/core/profiles/demo_umami/tests/src/FunctionalJavascript/OpenTelemetryAuthenticatedPerformanceTest.php
@@ -51,11 +51,11 @@ class OpenTelemetryAuthenticatedPerformanceTest extends PerformanceTestBase {
$expected = [
'QueryCount' => 4,
- 'CacheGetCount' => 42,
+ 'CacheGetCount' => 41,
'CacheGetCountByBin' => [
'config' => 22,
'discovery' => 5,
- 'data' => 7,
+ 'data' => 6,
'bootstrap' => 4,
'dynamic_page_cache' => 2,
'render' => 2,
diff --git a/core/profiles/standard/tests/src/FunctionalJavascript/StandardPerformanceTest.php b/core/profiles/standard/tests/src/FunctionalJavascript/StandardPerformanceTest.php
index 036447895e2..5a797ad874b 100644
--- a/core/profiles/standard/tests/src/FunctionalJavascript/StandardPerformanceTest.php
+++ b/core/profiles/standard/tests/src/FunctionalJavascript/StandardPerformanceTest.php
@@ -469,7 +469,7 @@ class StandardPerformanceTest extends PerformanceTestBase {
$this->assertSame($expected_queries, $recorded_queries);
$expected = [
'QueryCount' => 18,
- 'CacheGetCount' => 105,
+ 'CacheGetCount' => 104,
'CacheSetCount' => 1,
'CacheDeleteCount' => 1,
'CacheTagInvalidationCount' => 0,