mirror of https://github.com/devine-dl/devine.git
Delete file on failure in Requests and Curl-Impersonate downloaders
This commit is contained in:
parent
ba93c78b99
commit
5e858e1259
|
@ -96,6 +96,7 @@ def curl_impersonate(
|
||||||
download_sizes.clear()
|
download_sizes.clear()
|
||||||
break
|
break
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
out_path.unlink(missing_ok=True)
|
||||||
if DOWNLOAD_CANCELLED.is_set() or attempts == MAX_ATTEMPTS:
|
if DOWNLOAD_CANCELLED.is_set() or attempts == MAX_ATTEMPTS:
|
||||||
raise e
|
raise e
|
||||||
time.sleep(RETRY_WAIT)
|
time.sleep(RETRY_WAIT)
|
||||||
|
|
|
@ -98,6 +98,7 @@ def requests(
|
||||||
download_sizes.clear()
|
download_sizes.clear()
|
||||||
break
|
break
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
out_path.unlink(missing_ok=True)
|
||||||
if DOWNLOAD_CANCELLED.is_set() or attempts == MAX_ATTEMPTS:
|
if DOWNLOAD_CANCELLED.is_set() or attempts == MAX_ATTEMPTS:
|
||||||
raise e
|
raise e
|
||||||
time.sleep(RETRY_WAIT)
|
time.sleep(RETRY_WAIT)
|
||||||
|
|
Loading…
Reference in New Issue