Skip to content

Commit

Permalink
download_hash: use persistent session
Browse files Browse the repository at this point in the history
This allows to reuse http connection and be more efficient.
From rough measuring it saves around 25-30% of execution time.
  • Loading branch information
VannTen committed Sep 8, 2024
1 parent 86855be commit 1b1045c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion scripts/download_hash.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ def download_hash(only_downloads: [str]) -> None:
}

data, yaml = open_checksums_yaml()
s = requests.Session()

for download, url in (downloads if only_downloads == []
else {k:downloads[k] for k in downloads.keys() & only_downloads}).items():
Expand All @@ -124,7 +125,7 @@ def download_hash(only_downloads: [str]) -> None:
# to find new versions
if version in versions and versions[version] != 0:
continue
hash_file = requests.get(downloads[download].format(
hash_file = s.get(downloads[download].format(
version = version,
os = "linux",
arch = arch
Expand Down

0 comments on commit 1b1045c

Please sign in to comment.