Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
race_condition_ttl
set to 1 minute -- used to avoid race conditions)Motivation and Context
On 27 Oct, Autolab started returning 500 internal server errors due to the cache disk running out of inodes when attempting to write to the raw score caches. (autolab-error.pdf)
This is because FileStore caches (the default cache) are not purged automatically.
Reference: https://stackoverflow.com/questions/27502082/clearing-expired-cache-entries-from-disk-cache-on-ruby-on-rails-4
Unfortunately, there does not appear to be an easy way to periodically clear expired entries. In lieu of that, this PR adds a rake task and updates the documentation to facilitate the process
How Has This Been Tested?
Preliminary steps
rails dev:cache
development.rb
, replaceconfig.cache_store = :memory_store
withconfig.cache_store = :file_store, "tmp/cache/scores"
Test that rake task clears expired entries
:expires_in
andrace_condition_ttl
to5.seconds
(in all 3 places)<AUTOLAB DIR>/tmp/cache/scores
is populatedrake user:cleanup_cache
, observe that the (expired) entries are clearedTest that rake task does not clear unexpired entries
:expires_in
andrace_condition_ttl
back to their original values<AUTOLAB DIR>/tmp/cache/scores
is populatedrake user:cleanup_cache
, observe that the unexpired entries are not clearedrake user:clear_cache
and observe that the entries are clearedDocumentation
mkdocs serve
) and navigate tohttp://127.0.0.1:8000/installation/troubleshoot/#no-space-left-on-device-error
Types of changes
Checklist:
overcommit --install && overcommit --sign
to use pre-commit hook for linting