forked from DRMTalks/devine
Compare commits
3 Commits
d072190b11
...
2d7440ed95
Author | SHA1 | Date |
---|---|---|
Ninja Jiraiya | 2d7440ed95 | |
rlaphoenix | e7294c95d1 | |
rlaphoenix | 36b070f729 |
|
@ -1,4 +1,5 @@
|
|||
import math
|
||||
import os
|
||||
import time
|
||||
from concurrent import futures
|
||||
from concurrent.futures.thread import ThreadPoolExecutor
|
||||
|
@ -196,6 +197,9 @@ def requests(
|
|||
if not isinstance(urls, list):
|
||||
urls = [urls]
|
||||
|
||||
if not max_workers:
|
||||
max_workers = min(32, (os.cpu_count() or 1) + 4)
|
||||
|
||||
urls = [
|
||||
dict(
|
||||
save_path=save_path,
|
||||
|
@ -214,7 +218,8 @@ def requests(
|
|||
session = Session()
|
||||
session.mount("https://", HTTPAdapter(
|
||||
pool_connections=max_workers,
|
||||
pool_maxsize=max_workers
|
||||
pool_maxsize=max_workers,
|
||||
pool_block=True
|
||||
))
|
||||
session.mount("http://", session.adapters["https://"])
|
||||
|
||||
|
|
Loading…
Reference in New Issue