Repository navigation
firmware download: reuse a file already in the cache unless --force - #212
Merged
Merged
Conversation
A second `firmware download` of the same build went back to micropython.org, printed "downloading" and "download 100%", and only skipped the write when the server sent a Content-Length matching the cached file. A firmware file's name carries its build date and version, and a download only takes that name once it has finished, so a file of that name in the cache is now reused without going online. The result says "cached": true, and --force downloads it again. Checked against micropython.org: two downloads of ESP32_GENERIC_S3 1.29.0 took 0.5 s each and named the cached file; --force fetched all 1,783,296 bytes. Closes #210
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.
mpftp firmware downloadnow reuses a firmware file already in~/.mpftp/firmware-cache/files/without going online, and says so:already downloaded: PATH (--force fetches it again), with"cached": truein the result.--forcerefreshes the catalog and downloads the file again. Before, every call opened the download, printeddownloading ...anddownload 100%, and only skipped the write when the server's Content-Length matched the cached size.A file's name carries its build date and version (
ESP32_GENERIC_S3-20260824-v1.29.0.bin), and a download is written as.partialand renamed only when it finishes, so a file of that name is the same build and complete. The web flasher's download goes through the same function and gets the same reuse.Against micropython.org, two
firmware download --board ESP32_GENERIC_S3 --version 1.29.0calls each took 0.5 s and named the cached file;--forcefetched all 1,783,296 bytes again. New tests incli/tests/test_firmware_download.pycover reuse with no Content-Length,--force, and a cut-off.partialnot being reused; they fail without the change.Closes #210