Skip to content

[FrameworkBundle] Fix warming up routes #57554

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

Merged
merged 1 commit into from
Jun 28, 2024

Conversation

nicolas-grekas
Copy link
Member

Q A
Branch? 7.1
Bug fix? yes
New feature? no
Deprecations? no
Issues -
License MIT

Follows #52962 and builds on the semantics of #57553.

@@ -84,14 +84,12 @@ public function getRouteCollection(): RouteCollection

public function warmUp(string $cacheDir, ?string $buildDir = null): array
{
if (!$buildDir) {
return [];
if (null === $currentDir = $this->getOption('cache_dir')) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't the CacheWarmer not registered when the caching is disabled for the router ?

And with this change, the Router cache is generated once at build-time and once again if you run cache:warmup, right ?
If you run cache:warmup right after your deploy (thus, on a read-only buildDir), this will either fail or you regenerate the router cache in the cache_dir, which won't be used at all.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no it's not disabled if you set the router.cache_dir to null (which is the only way since the deprecation of the config option)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you run cache:warmup right after your deploy (thus, on a read-only buildDir), this will either fail or you regenerate the router cache in the cache_dir, which won't be used at all.

then, $buildDir will be null so that RouterCacheWarmer won't call this warmup method

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then, $buildDir will be null so that RouterCacheWarmer won't call this warmup method

Ah right, I got caught by the double warming layer of the Router... 👍

@nicolas-grekas nicolas-grekas merged commit 5831979 into symfony:7.1 Jun 28, 2024
6 of 10 checks passed
@fabpot fabpot mentioned this pull request Jun 28, 2024
@nicolas-grekas nicolas-grekas deleted the router-warmer branch July 18, 2024 08:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants