Skip to content

Commit

Permalink
Don't enable the cooldown unless explicitly requested by the caller
Browse files Browse the repository at this point in the history
  • Loading branch information
blue42u committed Oct 18, 2022
1 parent d02a514 commit b2f0f37
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/spack/spack/binary_distribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ def find_by_hash(self, find_hash, mirrors_to_check=None):
"""
if find_hash not in self._mirrors_for_spec:
# Not found in the cached index, pull the latest from the server.
self.update()
self.update(with_cooldown=True)
if find_hash not in self._mirrors_for_spec:
return None
results = self._mirrors_for_spec[find_hash]
Expand Down Expand Up @@ -290,7 +290,7 @@ def update_spec(self, spec, found_list):
"spec": new_entry["spec"],
}

def update(self):
def update(self, with_cooldown=False):
"""Make sure local cache of buildcache index files is up to date.
If the same mirrors are configured as the last time this was called
and none of the remote buildcache indices have changed, calling this
Expand Down Expand Up @@ -342,7 +342,8 @@ def update(self):
if cached_mirror_url in configured_mirror_urls:
# Only do a fetch if the last fetch was longer than TTL ago
if (
ttl > 0
with_cooldown
and ttl > 0
and cached_mirror_url in self._last_fetch_times
and now - self._last_fetch_times[cached_mirror_url] < ttl
):
Expand Down

0 comments on commit b2f0f37

Please sign in to comment.