-
Notifications
You must be signed in to change notification settings - Fork 40
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
Active compiled style files are being pruned away #20
Conversation
Yes, I'm fairly certain that caching must have something to do with it. As far as I can tell, the garbage collector is pruning all files older than a certain age, under the assumption that they will be regenerated automatically. But as long as the pages are being served from cache, there is no opportunity for regeneration. I would suggest modifying the garbage collector so that the most recent file is not pruned away. |
You are right: the collector is designed by thinking active stylesheets are going to be regenerated. I may look to generate them during garbage collection. Just need to check if the theme is available or safely loadable from cron. Meanwhile, I can add a Thanks for reporting! |
Active compiled style files are being pruned away
I am still seeing this issue (1.5.3). I did not have a filter for the TTL though. However, I think that the compilation strategies should include a check for the existence of the cached file. If it does not exist, that should trigger a compile. I will see if I can accomplish this with hooks. I will leave another comment here if I find a good solution. |
@fabrizim actually it is very hard to do that without doing that "runtime". The cleaning is done in the background during a WP-Cron so most of the Initially I did not want to introduce too much complexity with that feature and I recon it's more tricky than expected. Several hints:
I have very few time to work on it so if you have quick and effective bit of code to PR, you're welcome :-) |
I added a quick pull request (#40). Let me know if you think it might work, or if I am missing something. |
Yup I've just seen it. It advertise the origin of the problem: the database value is out of sync with the file system. I wonder how to deal with any cache system (like W3 TotalCache or Hyper Cache) as they rely on content and not on assets… |
I don't think cache systems are an issue... 1) many of them have the (default) option to deactivate caching while logged in, and 2) the first thing to try, if you're working on the site and you're having obvious "caching issues", would be to clear / turn off the cache ... |
I agree with @sebastianschmid - from what I know of w3 total cache, I am pretty sure it should work just like regular stylesheets: stylesheets are cached and changes won't be reflected until the cache is cleared. At that point, the css is generated as usual and then cached per their own caching algorithm. I'm pretty sure this PR would still work during that process. |
@oncletom - I hate to be a nuisance, and I know you are busy, but I have tested the referenced pull request and it has been working for me. Any chance you could pull it into master? I have several sites using this that are sourced from git and it would be great to resolve this issue (which has become fairly prominent on some sites). Thanks. |
@fabrizim you're totally right ;-) Thanks for reminding me! |
@oncletom Thanks! |
I checked my web site this morning to find out that the CSS was missing. Clearing my caches and forcing a recompile of my LESS file resolved the problem. I can confirm from my access logs that the WP-LESS garbage collector was active when the file went missing.
I did see the following message in my error logs from that time period. But more importantly, I need to figure out why GarbageCollector thinks it can remove my active files! My suspicion is that there is an undesirable interaction with my fastcgi caching.