Skip to content

Commit

Permalink
optimize fetch to use local download
Browse files Browse the repository at this point in the history
if source is already downloaded and can be verified, skip downloading again.
  • Loading branch information
h0tw1r3 committed Apr 17, 2024
1 parent b5ea0d6 commit 32ef13c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/vanagon/component/source/http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,13 @@ def initialize(url, sum:, workdir:, sum_type:, **options)
# Download the source from the url specified. Sets the full path to the
# file as @file and the @extension for the file as a side effect.
def fetch
@file = File.basename(URI.parse(@url).path)
begin
return if verify
rescue RuntimeError, Errno::ENOENT
remove_instance_variable(:@file)
end

@file = download(@url)
end

Expand Down

0 comments on commit 32ef13c

Please sign in to comment.