Hi there,

just noticed that old files generated by AdvAgg don't get deleted when a new one is created.

My website has now:

940mb of ~230kb .js files
70mb of ~80kb .css files

I just deleted them all, cleared cache at admin/settings/performance and js folder already has 20mb in 93 js files.

I have no clue how you coded the module, but just before it begins generating new files, it should empty both folders (css & js).

CommentFileSizeAuthor
#2 advagg-1161644-2.patch678 bytesmikeytown2

Comments

mikeytown2’s picture

This issue has to do with not deleting files if it's over 30 days old. I follow D7 Core
drupal_delete_file_if_stale() D7 is called by these 2 functions: drupal_clear_css_cache() D7 & drupal_clear_js_cache() D7

If you wish to adjust this, there are 3 setting in advagg that have to do with time.

/**
 * Default stale file threshold is 30 days for mtime.
 */
define('ADVAGG_STALE_FILE_THRESHOLD', 2592000);
variable_get('advagg_stale_file_threshold', ADVAGG_STALE_FILE_THRESHOLD);
// Compares against filemtime()

/**
 * Default stale file threshold is 15 days for atime.
 */
define('ADVAGG_STALE_FILE_LAST_USED_THRESHOLD', 1296000);
variable_get('advagg_stale_file_last_used_threshold', ADVAGG_STALE_FILE_LAST_USED_THRESHOLD);
// Compares against fileatime()

/**
 * Default file last used check-in is 12 hours.
 */
define('ADVAGG_FILE_LAST_USED_INTERVAL', 1296000);
variable_get('advagg_file_last_used_interval', ADVAGG_FILE_LAST_USED_INTERVAL);
// How often the cache_advagg cache is updated.

When adjusting these settings make sure that:
advagg_file_last_used_interval is longer then your cron runs.
advagg_stale_file_threshold is at least 4x advagg_file_last_used_interval
advagg_stale_file_last_used_threshold is 1/2 of advagg_file_last_used_interval

mikeytown2’s picture

Status: Active » Fixed
StatusFileSize
new678 bytes

going to move the defaults to 6 and 3 days. Marking this as fixed; let me know if you have any other issues. This might be related to your issue as well #1161570: Flushing the advagg cache not working.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.