Skip to content
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

avoid caching old assets preserved by sprockets #31

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

ashanbrown
Copy link

Because sprockets by default leaves around the 2 previous copies of any assets, the default behavior of rack-offline.rb for rails is to cache three times the necessary data. This code picks only the latest file (based on ctime) and adds that to the manifest. Wasn't sure if this warranted testing since there is no corresponding test for rack-offline.

@ashanbrown
Copy link
Author

Just a note about this: I've found that I have to sort by mtime to get the latest assets on heroku, even though sprockets picks the previous assets to keep based on ctime. This seems to happen because heroku appears to retain more than 3 copies of an asset for some reason, and manages to update the ctime of those stale assets to boot (all on rails4, fwiw).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants