Store cache timestamps to status pynamodb #205
Merged
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.
Motivation
Currently the
ModStatus
objects have propertieslast_checked
andlast_inflated
, which are identical, which is redundant. This is not a coincidence; the code sets them to the exact same value every time. They also appear on the status page:Problems
In KSP-CKAN/CKAN-meta@8006736, KerbalWeatherProject's release date was updated but its hashes were not. Subsequently attempting to install this mod resulted in hash mismatches:
So the author replaced the download, but the Inflator used the old download to re-index it.
Causes
There are two ways the Inflator might have inflated the old file:
Right now we cannot tell which it is, because we do not know the timestamp of the file in the Inflator's cache. We need that info to continue investigating and eventually find a fix. If the timestamp is close to the re-indexing request, then we blame SpaceDock for lying, otherwise we blame the Inflator for laziness.
Changes
Now
last_checked
is no longer set (but we won't purge the current values, just in case).last_inflated
will still be set to their common value, so no information is lost.Now a new
last_downloaded
property is set to the timestamp of the mod's download in the cache. To make this possible, the Indexer now mounts the cache directory, finds downloads in it, andstat
s them to get the timestamp. We carefully convert this to UTC to ensure that we can always track exactly what happened with a mod, minute by minute.A future PR will update the status page to show the new timestamps.