-
Notifications
You must be signed in to change notification settings - Fork 2
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
DEV-627: "since" uses filenames embedded in date #41
Conversation
@@ -139,13 +139,12 @@ Solr should be reachable via the `solr-sdr-catalog` hostname. | |||
### Indexing | |||
|
|||
Note that "today's file" is "the file that became available today", which | |||
will have _yesterday's_ date embedded in it. If you use these scripts you |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we have learned, one must always worry about off-by-one errors...
@@ -31,14 +31,16 @@ def solr_client | |||
|
|||
# Coerce a user-supplied Date or String to a Date within a block. | |||
def with_date(obj) | |||
date = obj | |||
unless obj.is_a? Date | |||
date = if obj.respond_to?(:to_date) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DateTime.is_a? Date
is true, but that also includes some spurious time zone information that is unlikely to be helpful and could end up with bad math in some cases... In this case we really want a Date
if we can; DateTime#to_date
, Time#to_date
, and Date#to_date
will all do that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be dandy to separate out the "agenda" or date list part of the code for unit testing for just this sort of error. Checked some examples and I'm happy with this.
Catalog file names are named using the day before they were produced, as is noted in the README.
When we did the "full" index, this calls the
since
command which was intended to process all incremental files starting with the one produced on the same date as the full file up to the one produced on the current date.However,
since
was subtracting a day from the start date, since its argument reflected the day the file was produced rather than the date in its name.This PR makes handling for all commands taking dates consistent and updates the documentation to reflect that.