• Resolved taropaa

    (@taropaa)


    Hi,

    I noticed that for busy sites, Autoptimize tends to mess up the page caches after a while if left alone for about 2-3+ Weeks. Cache sizes don’t seem to get too crazy, but all CSS and some js is broken on subpages.

    The solution, in that case, is to clear Autoptimize and then the page cache.

    Has anyone encountered this issue before?

    Using it with cache enabler, Cloudflare, and KeyCDN.

    Thank you in advance,

    Adrian

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Optimizing Matters

    (@optimizingmatters)

    AO itself never removes anything from its own cache, so the only thing I can think off is AO’s cache being cleared (either manually or by another plugin/ theme hooking into AO’s API or doing it on filesystem level) without the page cache being cleared?

    frank

    I have this same issue but I found what is responsible for that. Unfortunately this plugin have a cron job where files are deleting. I mean cron jon “ao_cachechecker” where function “autoptimizeCache::delete_advanced_cache_clear_artifacts()” deletes a good files, not only artifacts… It’s critical bug, please fix it asap.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    ao_cachechecker only checks cache size, but does not call delete_advanced_cache_clear_artifacts or any related function; AO by design does never clear it’s own cache, it must be something else beherit ..

    Take a look at your code ?? function cronjob() runs on this cronjob because you add action for it ?? And this function runs autoptimizeCache::delete_advanced_cache_clear_artifacts(); that removes files. No, it is not something else. I double checked it e.g. by manually runing cronjob ao_cachechecker.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    hmmm … you’re right about delete_advanced_cache_clear_artifacts() being called from ao_cachechecker. forgot about that ??

    now although something _could_ go wrong there, it would be a pretty obscure bug; the delete_advanced_cache_clear_artifacts function deletes files that were moved to a directory with a specific prefix as an alternative (faster) clear-cache method, but that alternative method is not used except when a filter is set. given no directories with that prefix exists, the function should not delete anything ..

    but I’ll dive into the code tomorrow to see where thing *could* go wrong and if I find any look for ways to make this less likely.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    OK, so did an in-depth review of the code in delete_advanced_cache_clear_artifacts, which;

    1. reads the contents of the parent of the autoptimize cache folder (so default wp-content/cache)
    2. for each item in that array is checks if the filename has the prefix autoptimize- and if that item is a directory
    3. only if both conditions are true, it removes the entire directory

    Based on this, I consider it next to impossible for this function to delete individual files in wp-content/cache/autoptimize/ except if you used a constant to rename the autoptimize cache-folder into autoptimize-<xyz>, in which case the entire directory with the real cache would be removed and (shortly after) get recreated by normal AO logic (making it look like individual files were deleted).

    Nevertheless I have added a check in said function to make sure it is only active when the “advanced cache clearing” is active as well, if only to ensure this logic isn’t executed when it isn’t needed and I changed the prefix from autoptimize- into autoptimize-artifacts- to make sure someone having set the constant to autoptimize-production or so won’t have the real cache directory deleted.

    You can download & test what will become AO26 from https://github.com/futtta/autoptimize/archive/beta.zip ??

    frank

    Everything is working perfectly now ??

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    So were you indeed using

    a constant to rename the autoptimize cache-folder into autoptimize-<xyz>

    ? ??

    Nowhere :/

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    hmmm … very bizarre, based on the code (even from before the changes made) this should not be happening.

    but glad it’s now no longer an issue, some extra precautions never hurt as proven once again ??

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Site issues after a while’ is closed to new replies.