Strategy: Temporarily remove response caching
The simple approach here caches all header or body content from responses, so memory usage continually grows with each fetch. This becomes more of a notable issue with long livecheck runs (e.g., `--tap homebrew/core`). Instead, we should only cache the header/body for URLs that we know will be fetched more than once in a given run. Being able to determine which URLs will be fetched more than once requires structural changes within livecheck strategies, so this will take a bit of work to implement. I've been working on this off and on and I'll introduce a more sophisticated method of livecheck-wide caching in a later PR. In the interim time, it's best to remove this caching behavior until I've finished working on an approach that provides benefits (reducing duplicate fetches) while minimizing detriments (increased memory usage).
This commit is contained in:
parent
f47c1eae32
commit
ac459f8e76
@ -82,10 +82,6 @@ module Homebrew
|
||||
end
|
||||
|
||||
def self.page_headers(url)
|
||||
@headers ||= {}
|
||||
|
||||
return @headers[url] if @headers.key?(url)
|
||||
|
||||
headers = []
|
||||
|
||||
[:default, :browser].each do |user_agent|
|
||||
@ -113,15 +109,14 @@ module Homebrew
|
||||
.to_h.transform_keys(&:downcase)
|
||||
end
|
||||
|
||||
return (@headers[url] = headers) if status.success?
|
||||
return headers if status.success?
|
||||
end
|
||||
|
||||
headers
|
||||
end
|
||||
|
||||
def self.page_content(url)
|
||||
@page_content ||= {}
|
||||
@page_content[url] ||= URI.parse(url).open.read
|
||||
URI.parse(url).open.read
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user