Fix target_window
when redirect is > 1 day
#53
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.
The
target_window
parameter forget_memento()
is supposed to limit how far off in time from the requested time you can get a memento for when theexact
parameter isFalse
. However, it only works correctly when the target is off by less than a day! (The scenarios we were originally concerned with in EDGI almost invariably were on the scale of a few hours, so I guess that's how this error snuck in. 😬) If you setexact=True
(the default), this bug wouldn’t be triggered.We were checking the target offset by the number of seconds, irrespective of the additional number of days involved. We should have been checking by
total_seconds
, which converts the days into seconds and includes them. I’ve also added tests here to make sure this problem doesn’t occur again.This PR targets the v0.2.x branch; I’ll add a new PR for
main
(which is now for v0.3.x) after this merges.