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.
This is a spiritual successor to #3157.
Problem
A Discord user and I saw the same issue described in #3157:
netkan.exe
repeatedly purging and re-downloading a cache entry that it thought it was stale. The file was uploaded less than an hour previously, and I'm in the western hemisphere.Cause
Here
updatedToken
will be aJToken
object representing the (correct) value ofrelease_date
in the .ckan file, which includes timezone info:CKAN/Netkan/Model/Metadata.cs
Lines 112 to 118 in 90fdf7a
To convert it to a
DateTime
, we:string
, which internally results in something like12/21/2020 7:53:07 PM
, lacking timezone infostring
into aDateTime
, which also lacks timezone infoToUniversalTime()
, which adds (subtracts?) the local timezone offset to the timestamp, which for me was moving it into the future, which meant that my local file was always too old to result in a cache hitChanges
Now we cast directly from
JToken
toDateTime
, which is allowed and preserves the timezone info:This fixed the mistaken cache purging in my testing.