Login!
Lost password?
 

MODx Bug/Feature Tracker and Feature Requests

Welcome to the MODx CMS Tracker. Please choose the appropriate project from the drop down menu and provide as much information as possible regarding your server environment and browser. Thanks!

FS#170 — Refresh site requires multiple tries

Attached to Project — MODx
Opened by Jared Carlow (jaredc) - Wednesday, 21 December 2005, 12:49PM
Last edited by Jared Carlow (jaredc) - Thursday, 31 August 2006, 07:55AM
Task Type Bug Report
Category Core Distribution
Status Closed
Assigned To Jared Carlow (jaredc)
Operating System All
Severity Medium
Priority Normal
Reported Version 0.9.0
Due in Version 0.9.5
Due Date Undecided
Percent Complete 100%

Details

When I use "Refresh site" - it wipes a bunch of files out of the cache. But not all of them. Usually about 100-250 or so. So when I want to refresh the WHOLE site, I have to use that link 5 or 6 times to clear all the cached files. It appears to me that there's just some sort of limit to the number of files that it will clear out. So it will do at most, a couple hundred at a time.
This task depends upon

This task blocks these from closing
Closed by  Ryan Thrash (rthrash)
Tuesday, 03 October 2006, 01:30PM
Reason for closing:  Fixed
Comment by Jared Carlow (jaredc) - Thursday, 31 August 2006, 07:55AM
Bah HA!!!

Finally some progress. I tried a variety of methods for getting this cache clearing thing to loop if it detected that not all the cached files were cleared. But to no avail until...

I discovered that the problem was that when opendir() was called, a snapshot of the directory was being taken. And incompletely so I might add. So that no matter how many times you looped thru - it wouldn't detect other pages because the original snapshot was incomplete. It just wasn't seeing the other cache files.

So I added a few lines of code that do the following things:

1) Check to see if any files were deleted in a pass. If so, then another pass is requested (until it runs thru without deleting anything)

2) The opendir is CLOSED after each pass, forcing a new snapshot of the directory to be taken

3) Verify that a file is only removed from cache once. Thus if someone visits your site while cache is clearing, the "new" cache page for the page they're visiting doesn't throw this routine into an endless loop!

Ah finally... and the other good news is that for systems that haven't demonstrated this problem, it will run as normal [almost] with only two filesystem open and close (the first to do the actual work, the second to verify). So minimal degradation in performance!! Woot woot.

Rev. #1347