forked from DRMTalks/devine
Compare commits
3 Commits
c77d521a42
...
905f5706eb
Author | SHA1 | Date |
---|---|---|
Ninja Jiraiya | 905f5706eb | |
rlaphoenix | 1bff87bd70 | |
rlaphoenix | 5376e4c042 |
|
@ -7,6 +7,7 @@ from pathlib import Path
|
||||||
from typing import Any, Generator, MutableMapping, Optional, Union
|
from typing import Any, Generator, MutableMapping, Optional, Union
|
||||||
|
|
||||||
from requests import Session
|
from requests import Session
|
||||||
|
from requests.adapters import HTTPAdapter
|
||||||
from rich import filesize
|
from rich import filesize
|
||||||
|
|
||||||
from devine.core.constants import DOWNLOAD_CANCELLED
|
from devine.core.constants import DOWNLOAD_CANCELLED
|
||||||
|
@ -211,6 +212,12 @@ def requests(
|
||||||
]
|
]
|
||||||
|
|
||||||
session = Session()
|
session = Session()
|
||||||
|
session.mount("https://", HTTPAdapter(
|
||||||
|
pool_connections=max_workers,
|
||||||
|
pool_maxsize=max_workers
|
||||||
|
))
|
||||||
|
session.mount("http://", session.adapters["https://"])
|
||||||
|
|
||||||
if headers:
|
if headers:
|
||||||
headers = {
|
headers = {
|
||||||
k: v
|
k: v
|
||||||
|
|
|
@ -98,9 +98,6 @@ class Service(metaclass=ABCMeta):
|
||||||
backoff_factor=0.2,
|
backoff_factor=0.2,
|
||||||
status_forcelist=[429, 500, 502, 503, 504]
|
status_forcelist=[429, 500, 502, 503, 504]
|
||||||
),
|
),
|
||||||
# 16 connections is used for byte-ranged downloads
|
|
||||||
# double it to allow for 16 non-related connections
|
|
||||||
pool_maxsize=16 * 2,
|
|
||||||
pool_block=True
|
pool_block=True
|
||||||
))
|
))
|
||||||
session.mount("http://", session.adapters["https://"])
|
session.mount("http://", session.adapters["https://"])
|
||||||
|
|
Loading…
Reference in New Issue