mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Merge pull request #20169 from boblail/lail/invalidate-download-cache-logging
download_strategy: Add logging when a cached download is being ignored
This commit is contained in:
commit
ca510da620
@ -482,10 +482,17 @@ class CurlDownloadStrategy < AbstractFileDownloadStrategy
|
|||||||
# The cached location is no longer fresh if either:
|
# The cached location is no longer fresh if either:
|
||||||
# - Last-Modified value is newer than the file's timestamp
|
# - Last-Modified value is newer than the file's timestamp
|
||||||
# - Content-Length value is different than the file's size
|
# - Content-Length value is different than the file's size
|
||||||
if cached_location_valid
|
if cached_location_valid && last_modified && last_modified > cached_location.mtime
|
||||||
newer_last_modified = last_modified && last_modified > cached_location.mtime
|
ohai "Ignoring #{cached_location}",
|
||||||
different_file_size = file_size&.nonzero? && file_size != cached_location.size
|
"Cached modified time #{cached_location.mtime.iso8601} is before" \
|
||||||
cached_location_valid = !(newer_last_modified || different_file_size)
|
"Last-Modified header: #{last_modified.iso8601}"
|
||||||
|
cached_location_valid = false
|
||||||
|
end
|
||||||
|
if cached_location_valid && file_size&.nonzero? && file_size != cached_location.size
|
||||||
|
ohai "Ignoring #{cached_location}",
|
||||||
|
"Cached size #{cached_location.size} differs from " \
|
||||||
|
"Content-Length header: #{file_size}"
|
||||||
|
cached_location_valid = false
|
||||||
end
|
end
|
||||||
|
|
||||||
if cached_location_valid
|
if cached_location_valid
|
||||||
|
Loading…
x
Reference in New Issue
Block a user