Retry failed harvest requests, and fail loudly when they don't recover - #214
Draft
thatbudakguy wants to merge 1 commit into
Draft
thatbudakguy wants to merge 1 commit into
thatbudakguy wants to merge 1 commit into
Conversation
thatbudakguy
added this pull request to stack #218
September 17, 2026 23:43
Both response classes rescued every error while paging, nil'd the
response, and left their loop, so #index returned normally after a single
transient failure: a harvest that indexed 6 of 15 documents exited 0 and
looked like a success. Individual document failures were dropped the same
way, by compacting them out of the page.
Requests now go through retries with an exponential backoff for failures
that tend to be transient -- connection resets, broken pipes, timeouts,
TLS errors, 5xx, rate limiting -- and a request that still can't be
completed raises GeoCombine::Exceptions::HarvestError. A 404 for a single
document is logged and skipped instead, since a record can be indexed but
unreadable.
Responses are checked rather than trusted, since a status code alone
can't tell a page of records from a rejection:
- a 200 carrying HTML, or any body that isn't a JSON object, is treated
as a failure worth retrying rather than parsed as a document
- every page is validated as a page of search results, not just the
first one through the response factory; a 200 carrying JSON that
isn't one used to read as "no more results" and end the harvest
- a result with no link to itself, and a page whose every document was
skipped, are logged rather than quietly dropped
Closes #208
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
thatbudakguy
force-pushed
the
208-fail-loudly
branch
from
September 17, 2026 23:43
6b0b2c0 to
80f1974
Compare
thatbudakguy
marked this pull request as draft
September 17, 2026 23:47
thatbudakguy
removed this pull request from stack #218
September 18, 2026 20:18
thatbudakguy
added this pull request to stack #219
September 18, 2026 20:31
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #208
Both response classes rescued every error while paging, nil'd the response and left their loop, so
#indexreturned normally after a single transient failure — the 6-of-15-documents-and-exit-0 case in the issue. Individual document failures were dropped the same way, by compacting them out of the page.Requests now go through retries with an exponential backoff for failures that tend to be transient — connection resets, broken pipes, timeouts, TLS errors, 5xx, rate limiting — and a request that still can't be completed raises
GeoCombine::Exceptions::HarvestError. A 404 for a single document is logged and skipped instead, since a record can be indexed but unreadable.Responses are checked rather than trusted, since a status code alone can't tell a page of records from a rejection:
null, viaJSON.parsereturning nilDecisions to check
LegacyBlacklightResponseis fixed too, though the issue title names onlyModernBlacklightResponse— it had the identical swallow, and the central fix covers both. Leaving one behind would have meant Legacy still truncating harvests silently.max_retries,retry_delay, globally or per site). Both go slightly beyond the issue's literal list; rate limiting is the most likely response to an aggressive harvester and the thing Change crawl_delay to apply per-request #209's pacing exists to avoid, so it seemed in the spirit of "failures are actually relatively common in production". Easy to drop if you'd rather keep to the list./rawroute that moves shouldn't turn into a zero-document success that looks like an empty site either. Error-level logging is the compromise; happy to make it fatal instead.Note that
Net::HTTPalready retries once, without delay, for most of the error classes the issue lists; these retries stack on top of that.