Skip to content

Commit 6ac67f5

Browse files
authored
Improve resume (#12)
1 parent 7bcbd7f commit 6ac67f5

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

tools/idf_tools.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -923,13 +923,6 @@ def download(url: str, destination: str, is_retry: bool = False) -> Union[None,
923923
"""
924924
info(f'Downloading {url}')
925925
info(f'Destination: {destination}')
926-
927-
# Check for existing partial download to resume (skip on retry to start fresh)
928-
resume_from = 0
929-
if not is_retry and os.path.isfile(destination):
930-
resume_from = os.path.getsize(destination)
931-
if resume_from > 0:
932-
info(f'Found partial download ({resume_from} bytes), will attempt to resume')
933926

934927
# Get SSL fallback contexts for robust SSL handling
935928
ssl_contexts = get_ssl_fallback_contexts(url)
@@ -939,6 +932,13 @@ def download(url: str, destination: str, is_retry: bool = False) -> Union[None,
939932
try:
940933
info(f'Trying SSL configuration: {config_name}')
941934

935+
# Check for existing partial download to resume (skip on retry to start fresh)
936+
resume_from = 0
937+
if not is_retry and os.path.isfile(destination):
938+
resume_from = os.path.getsize(destination)
939+
if resume_from > 0:
940+
info(f'Found partial download ({resume_from} bytes), will attempt to resume')
941+
942942
if url.startswith('https'):
943943
# HTTPS with specific SSL context
944944
headers = {'User-Agent': 'pioarduino'}

0 commit comments

Comments
 (0)