update
This commit is contained in:
@@ -73,6 +73,8 @@ class HydrusNetwork:
|
||||
url: str
|
||||
access_key: str = ""
|
||||
timeout: float = 9.0
|
||||
upload_io_timeout: float = 120.0
|
||||
upload_chunk_size: int = 64 * 1024
|
||||
instance_name: str = "" # Optional store name (e.g., 'home') for namespaced logs
|
||||
|
||||
scheme: str = field(init=False)
|
||||
@@ -167,6 +169,37 @@ class HydrusNetwork:
|
||||
f"{self._log_prefix()} Uploading file {file_path.name} ({file_size} bytes)"
|
||||
)
|
||||
|
||||
# Upload timeout policy:
|
||||
# - Keep normal requests fast via `self.timeout`.
|
||||
# - For streaming uploads, use an activity timeout for read/write so
|
||||
# long transfers do not fail due to a short generic timeout.
|
||||
# - If upload_io_timeout <= 0, disable read/write timeout entirely.
|
||||
try:
|
||||
upload_io_timeout = float(self.upload_io_timeout)
|
||||
except Exception:
|
||||
upload_io_timeout = 120.0
|
||||
if upload_io_timeout <= 0:
|
||||
upload_timeout = httpx.Timeout(
|
||||
connect=float(self.timeout),
|
||||
read=None,
|
||||
write=None,
|
||||
pool=float(self.timeout),
|
||||
)
|
||||
else:
|
||||
upload_timeout = httpx.Timeout(
|
||||
connect=float(self.timeout),
|
||||
read=upload_io_timeout,
|
||||
write=upload_io_timeout,
|
||||
pool=float(self.timeout),
|
||||
)
|
||||
|
||||
try:
|
||||
chunk_size = int(self.upload_chunk_size)
|
||||
except Exception:
|
||||
chunk_size = 64 * 1024
|
||||
if chunk_size <= 0:
|
||||
chunk_size = 64 * 1024
|
||||
|
||||
# Stream upload body with a stderr progress bar (pipeline-safe).
|
||||
from SYS.models import ProgressBar
|
||||
|
||||
@@ -198,7 +231,7 @@ class HydrusNetwork:
|
||||
try:
|
||||
with file_path.open("rb") as handle:
|
||||
while True:
|
||||
chunk = handle.read(256 * 1024)
|
||||
chunk = handle.read(chunk_size)
|
||||
if not chunk:
|
||||
break
|
||||
sent[0] += len(chunk)
|
||||
@@ -216,6 +249,7 @@ class HydrusNetwork:
|
||||
url,
|
||||
content=file_gen(),
|
||||
headers=headers,
|
||||
timeout=upload_timeout,
|
||||
raise_for_status=False,
|
||||
log_http_errors=False,
|
||||
)
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
"((1fichier\\.com|megadl\\.fr|alterupload\\.com|cjoint\\.net|desfichiers\\.com|dfichiers\\.com|mesfichiers\\.org|piecejointe\\.net|pjointe\\.com|tenvoi\\.com|dl4free\\.com)/\\?[a-zA-Z0-9]{5,30}(&pw=[^&]+)?)"
|
||||
],
|
||||
"regexp": "((1fichier\\.com|megadl\\.fr|alterupload\\.com|cjoint\\.net|desfichiers\\.com|dfichiers\\.com|mesfichiers\\.org|piecejointe\\.net|pjointe\\.com|tenvoi\\.com|dl4free\\.com)/\\?[a-zA-Z0-9]{5,30}(&pw=[^&]+)?)",
|
||||
"status": true
|
||||
"status": false
|
||||
},
|
||||
"rapidgator": {
|
||||
"name": "rapidgator",
|
||||
@@ -398,7 +398,7 @@
|
||||
"(gigapeta\\.com/dl/[0-9a-zA-Z]{13,15})"
|
||||
],
|
||||
"regexp": "(gigapeta\\.com/dl/[0-9a-zA-Z]{13,15})",
|
||||
"status": true
|
||||
"status": false
|
||||
},
|
||||
"google": {
|
||||
"name": "google",
|
||||
@@ -425,7 +425,7 @@
|
||||
"(hexupload\\.net|hexload\\.com)/([a-zA-Z0-9]{12})"
|
||||
],
|
||||
"regexp": "(hexupload\\.net|hexload\\.com)/([a-zA-Z0-9]{12})",
|
||||
"status": true
|
||||
"status": false
|
||||
},
|
||||
"hot4share": {
|
||||
"name": "hot4share",
|
||||
@@ -494,7 +494,7 @@
|
||||
"mediafire\\.com/(\\?|download/|file/|download\\.php\\?)([0-9a-z]{15})"
|
||||
],
|
||||
"regexp": "mediafire\\.com/(\\?|download/|file/|download\\.php\\?)([0-9a-z]{15})",
|
||||
"status": true
|
||||
"status": false
|
||||
},
|
||||
"mixdrop": {
|
||||
"name": "mixdrop",
|
||||
@@ -652,7 +652,7 @@
|
||||
"(uploadboy\\.com/[0-9a-zA-Z]{12})"
|
||||
],
|
||||
"regexp": "(uploadboy\\.com/[0-9a-zA-Z]{12})",
|
||||
"status": true
|
||||
"status": false
|
||||
},
|
||||
"uploader": {
|
||||
"name": "uploader",
|
||||
@@ -690,7 +690,7 @@
|
||||
"uploadrar\\.(net|com)/([0-9a-z]{12})"
|
||||
],
|
||||
"regexp": "((get|cloud)\\.rahim-soft\\.com/([0-9a-z]{12}))|((fingau\\.com/([0-9a-z]{12})))|((tech|miui|cloud|flash)\\.getpczone\\.com/([0-9a-z]{12}))|(miui.rahim-soft\\.com/([0-9a-z]{12}))|(uploadrar\\.(net|com)/([0-9a-z]{12}))",
|
||||
"status": true,
|
||||
"status": false,
|
||||
"hardRedirect": [
|
||||
"uploadrar.com/([0-9a-zA-Z]{12})"
|
||||
]
|
||||
@@ -775,7 +775,7 @@
|
||||
"(worldbytez\\.(net|com)/[a-zA-Z0-9]{12})"
|
||||
],
|
||||
"regexp": "(worldbytez\\.(net|com)/[a-zA-Z0-9]{12})",
|
||||
"status": true
|
||||
"status": false
|
||||
}
|
||||
},
|
||||
"streams": {
|
||||
|
||||
Reference in New Issue
Block a user