Skip to content
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

Merged
merged 1 commit into from
Jan 23, 2024

Conversation

aelkiss
Copy link
Member

@aelkiss aelkiss commented Jan 11, 2024

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.

@aelkiss aelkiss requested a review from moseshll January 11, 2024 22:36
@@ -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
Copy link
Member Author

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)
Copy link
Member Author

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.

Copy link

Coverage Status

coverage: 91.258% (+0.2%) from 91.073%
when pulling ff0d027 on DEV-627-since-uses-filename
into 26af75a on main.

Copy link
Contributor

@moseshll moseshll left a 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.

@aelkiss aelkiss merged commit ab9145b into main Jan 23, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants