-
-
Notifications
You must be signed in to change notification settings - Fork 271
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
[LiveComponent] TemplateCacheWarmer not warming up cache #1522
Comments
In your second example is everything working ? Or is the file destroyed ? |
The |
Hmm.. @kbond maybe has a immediate idea ? It seems very weird that the |
I've added some debugging and the stack trace tells me:
Could it be that the file must be located in the build dir? We've got some strict directory rules as the app gets deployed through Debian packages and therefore cache and build are completley seperated. |
I'll try it later. My gut says that there's an issue if the cache dir is not the same as the build dir. Can you try to change those easily in your ux project? Otherwise I'll come back tomorrow on this. |
Hmm, I didn't know this class existed. @sneakyvv, any ideas here? |
Some more digging: I've reverted some changes in the app to get back to a working version. The last change I did not revert is the upgrade to Symfony 6. It seems that there's a compat issue.
Could it be related to the new |
Yes it's probably related indeed... do the other cachewarmer use build dir now ? That what you say ? |
Well there is something not working there.. If i hardcode the build directory like this // Kernel.php
class Kernel extends BaseKernel
{
use MicroKernelTrait;
public function getBuildDir(): string
{
// if (isset($_SERVER['APP_BUILD_DIR'])) {
// return $_SERVER['APP_BUILD_DIR'].'/'.$this->environment;
// }
return '/foo-bar/var/build/prod';
//return $this->getProjectDir().'/var/build/'.$this->environment;
}
} I updated the Warmer to generate in both build and cache directories And i added some "echo" lines to debug (in a dirty way, i know ... 😶🌫️ ). First time i run
The second time....
I have no idea where this 'pro_' comes from -- Moreover, i reproduced your problem locally, do we agree everything is OK if you start with a |
Ok, the "pro_" is a legit step of the cache-clear. When i hard-code some "$buildDir ?? $cacheDir" in the TemplateCacheWarmer it seems to work when build dir is different from cacheDir But i'd like to understand what is happening before making changes (and we must be sure everything work for people without custom buildDir, etc etc..) |
Per default `build_dir` = `cache_dir` so that won't change a thing. In projects having a distinct build directory, it fixes a bug where cache:clear did not create the file. (cf symfony#1522)
Regarding what Symfony does: I've only found the So there a magical things happening when the additional - not yet required Which is a non-optional cache warmer and this is using the build dir. |
When you have time, please tell me if #1525 works for you :) |
I've just baked an update and the changes work with our setup... 🥳
The cache file is located in the build dir and happy survives any cache clearing. |
Perfect! Thank you for all the details, context, etc :) Makes it easier to debug! |
Hi,
I've got an issue warming up the cache on PROD:
The dump is the
warmUp
call of thePhpArrayAdapter
and dumps$this->file
.In the first warmup the LiveComponent cache is warmed up before the cache get's cleared. I tracked this down to the container build process. Only on the 2nd run the warmer is called after clearing the cache. I've managed to track this to the
isOptional=false
setting in the LiveComponent'sTemplateCacheWarmer
and I'm now confused if this is a bug in Symfony, in the LiveComponent or somewhere in my app?I'm running the latest Symfony 6.4 right now.
Kind regards
Matthias
The text was updated successfully, but these errors were encountered: