Repository navigation
Cache downloads no longer time out after 60 seconds (Z22a) - #26
Merged
Merged
Conversation
utils::download.file() honours R's 60-second default timeout, so the 641 MB geocoded BMF never finished downloading on an ordinary connection, nccs_read() silently fell back to S3, and .part files piled up. A shared helper now uses the curl package when installed (no such limit) and otherwise raises the timeout to an hour for the download only; a stale or failed partial file is always removed. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Per review: download.file() can report failure through its return value without raising an error, leaving a partial file that would then have been renamed into the cache. The status is now checked before the rename. The fallback path is exercised in tests via a use_curl argument and a mocked download.file(), rather than skipped when curl is installed. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Collaborator
Author
|
Fixed. The fallback path now checks |
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.
nccs-contracts BACKLOG Z22 (a).
Problem.
nccs_read(cache = TRUE)downloads the 641 MB geocoded Unified BMF withutils::download.file(), which stops after R's default 60-second timeout. On an ordinary connection the copy never completed, the function quietly read from S3 instead, and unfinished.partfiles accumulated in the cache folder. The CORE partition download had the same shape.Fix. One helper,
.download_to_cache(), used by both call sites:curlpackage when it is installed (already a suggested dependency; no timeout of its own),options(timeout)to at least an hour for the download only and restores it afterwards,.partbefore starting and on failure, so nothing piles up.No change to the public interface.
withradded to Suggests for the tests. Three tests (success, failure cleanup, timeout restore on the fallback path); full suite passes.🤖 Generated with Claude Code