This repository has been archived by the owner on Dec 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Apply retries around the whole download operation (#44)
* Use the File's name throughout * Use the term 'destination' to match name in store function * Improve error handling by not ignoring the error when creating directory * Extract method for creating file * Move file handling up into process function * Switch the order of creating the file and getting it from S3. * Extract function for copying S3Object to a local File * Convert readHEAD function to copy the contents to a temp file on disk and then read from that. By mimicking the way the rest of this class works we'll be able to reuse code better in the following steps * Extract function that does the work inside the retry loop * Pass the file object down to where we will need it * Copy to file inside the retry loop * Remove some unnecessary code * Reset the file if copying fails. * Small tidies * Inline getObject method * Handle errors resetting the file between retries * Fix logging problem * Use an S3Getter interface as a structural type to make testing easier * Start building test * First test coming along * Test the happy case * Suite of tests to check various failure cases. * Make the time between retries configurable so I can lower it during tests * Tidy up and fix consistency * Fix formatting * Change error message to better reflect the failure case
- Loading branch information
Showing
2 changed files
with
241 additions
and
31 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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