Skip to content

Commit 57bbc37

Browse files
author
catch
committed
Issue #3504559 by berdir: AssetResolver may load the same cache several time on a single page with bigpipe
1 parent 2e94363 commit 57bbc37

File tree

4 files changed

+18
-6
lines changed

4 files changed

+18
-6
lines changed

core.services.yml

+13-1
Original file line numberDiff line numberDiff line change
@@ -1710,9 +1710,21 @@ services:
17101710
class: Drupal\Core\Asset\LibraryDependencyResolver
17111711
arguments: ['@library.discovery']
17121712
Drupal\Core\Asset\LibraryDependencyResolverInterface: '@library.dependency_resolver'
1713+
# Set up a cache chain for asset caching as the same assets may be
1714+
# requested several times, non-public as they are not meant to be reused.
1715+
cache.asset_memory:
1716+
class: Drupal\Core\Cache\MemoryCache\MemoryCache
1717+
arguments: ['@datetime.time']
1718+
public: false
1719+
cache.asset_chain:
1720+
class: Drupal\Core\Cache\BackendChain
1721+
public: false
1722+
calls:
1723+
- [ appendBackend, [ '@cache.asset_memory' ] ]
1724+
- [ appendBackend, [ '@cache.data' ] ]
17131725
asset.resolver:
17141726
class: Drupal\Core\Asset\AssetResolver
1715-
arguments: ['@library.discovery', '@library.dependency_resolver', '@module_handler', '@theme.manager', '@language_manager', '@cache.data', '@theme_handler']
1727+
arguments: ['@library.discovery', '@library.dependency_resolver', '@module_handler', '@theme.manager', '@language_manager', '@cache.asset_chain', '@theme_handler']
17161728
Drupal\Core\Asset\AssetResolverInterface: '@asset.resolver'
17171729
info_parser:
17181730
class: Drupal\Core\Extension\InfoParser

modules/navigation/tests/src/FunctionalJavascript/PerformanceTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,10 @@ public function testLogin(): void {
7373

7474
$expected = [
7575
'QueryCount' => 4,
76-
'CacheGetCount' => 59,
76+
'CacheGetCount' => 58,
7777
'CacheGetCountByBin' => [
7878
'config' => 11,
79-
'data' => 6,
79+
'data' => 5,
8080
'discovery' => 10,
8181
'bootstrap' => 6,
8282
'dynamic_page_cache' => 2,

profiles/demo_umami/tests/src/FunctionalJavascript/OpenTelemetryAuthenticatedPerformanceTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ public function testFrontPageAuthenticatedWarmCache(): void {
5151

5252
$expected = [
5353
'QueryCount' => 4,
54-
'CacheGetCount' => 42,
54+
'CacheGetCount' => 41,
5555
'CacheGetCountByBin' => [
5656
'config' => 22,
5757
'discovery' => 5,
58-
'data' => 7,
58+
'data' => 6,
5959
'bootstrap' => 4,
6060
'dynamic_page_cache' => 2,
6161
'render' => 2,

profiles/standard/tests/src/FunctionalJavascript/StandardPerformanceTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ protected function testLoginBlock(): void {
469469
$this->assertSame($expected_queries, $recorded_queries);
470470
$expected = [
471471
'QueryCount' => 18,
472-
'CacheGetCount' => 105,
472+
'CacheGetCount' => 104,
473473
'CacheSetCount' => 1,
474474
'CacheDeleteCount' => 1,
475475
'CacheTagInvalidationCount' => 0,

0 commit comments

Comments
 (0)