anaconda: change anaconda installers scanning

This commit is contained in:
Miao Wang 2025-05-06 15:14:05 +08:00
parent e311a59a63
commit 4764ee0d68

View File

@ -273,6 +273,7 @@ def sync_installer(repo_url, local_dir: Path):
logging.info("Start syncing {}".format(repo_url)) logging.info("Start syncing {}".format(repo_url))
local_dir.mkdir(parents=True, exist_ok=True) local_dir.mkdir(parents=True, exist_ok=True)
full_scan = random.random() < 0.1 # Do full version check less frequently full_scan = random.random() < 0.1 # Do full version check less frequently
scan_futher = True
def remote_list(): def remote_list():
r = requests.get(repo_url, timeout=TIMEOUT_OPTION) r = requests.get(repo_url, timeout=TIMEOUT_OPTION)
@ -293,6 +294,9 @@ def sync_installer(repo_url, local_dir: Path):
dst_file_wip = local_dir / (".downloading." + filename) dst_file_wip = local_dir / (".downloading." + filename)
if dst_file.is_file(): if dst_file.is_file():
if not scan_futher:
logging.info("Skipping {} without checking".format(filename))
continue
r = requests.head(pkg_url, allow_redirects=True, timeout=TIMEOUT_OPTION) r = requests.head(pkg_url, allow_redirects=True, timeout=TIMEOUT_OPTION)
len_avail = "content-length" in r.headers len_avail = "content-length" in r.headers
if len_avail: if len_avail:
@ -313,7 +317,7 @@ def sync_installer(repo_url, local_dir: Path):
# Stop the scanning if the most recent version is present # Stop the scanning if the most recent version is present
if not full_scan: if not full_scan:
logging.info("Stop the scanning") logging.info("Stop the scanning")
break scan_futher = False
continue continue