From d10fe1a3b71b23587fbe00fa0c51c46a2e22407a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eric=20Meadows-J=C3=B6nsson?= Date: Sat, 10 Dec 2016 00:27:48 +0100 Subject: [PATCH] Do not make conditional HTTP request if file is missing Re: HashNuke/heroku-buildpack-elixir#93 --- lib/hex/scm.ex | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/hex/scm.ex b/lib/hex/scm.ex index 0d4a01a60..d6fbf6f95 100644 --- a/lib/hex/scm.ex +++ b/lib/hex/scm.ex @@ -193,10 +193,10 @@ defmodule Hex.SCM do fetch = fetch_from_lock(lock) Enum.each(fetch, fn {package, version} -> - etag = Hex.Registry.tarball_etag(package, version) + filename = "#{package}-#{version}.tar" + path = cache_path(filename) + etag = File.exists?(path) && Hex.Registry.tarball_etag(package, version) Hex.Parallel.run(:hex_fetcher, {:tarball, package, version}, fn -> - filename = "#{package}-#{version}.tar" - path = cache_path(filename) fetch(filename, path, etag) end) end)