feat: stabilize multi-region runtime sync and worker orchestration
This commit is contained in:
@@ -15,10 +15,23 @@ import subprocess
|
||||
import execjs
|
||||
|
||||
|
||||
def _resolve_geetest_asset_timeout():
|
||||
connect_timeout = max(
|
||||
0.3,
|
||||
float(os.getenv("DOMAINCHECK_GEETEST_ASSET_CONNECT_TIMEOUT", "2.0") or 2.0),
|
||||
)
|
||||
read_timeout = max(
|
||||
0.5,
|
||||
float(os.getenv("DOMAINCHECK_GEETEST_ASSET_READ_TIMEOUT", "4.0") or 4.0),
|
||||
)
|
||||
return (connect_timeout, read_timeout)
|
||||
|
||||
|
||||
class slide():
|
||||
def __init__(self):
|
||||
self.headers = randomUA()
|
||||
self.t = round(time.time() * 1000)
|
||||
self.asset_timeout = _resolve_geetest_asset_timeout()
|
||||
|
||||
def __ease_out_expo(self, sep):
|
||||
if sep == 1:
|
||||
@@ -83,7 +96,7 @@ class slide():
|
||||
for idv, p_url in vdict.items():
|
||||
p_url = 'http://static.geetest.com/' + p_url
|
||||
# print(p_url)
|
||||
vcode = requests.get(p_url, headers=self.headers)
|
||||
vcode = requests.get(p_url, headers=self.headers, timeout=self.asset_timeout)
|
||||
text = vcode.content
|
||||
if idv == 'bg':
|
||||
text = self.tp_huanyuan(text)
|
||||
@@ -131,7 +144,7 @@ class Geetest2():
|
||||
"callback": f"geetest_{self.t}"
|
||||
}
|
||||
try:
|
||||
respe = http.get(url=url, params=params, proxies=proxies).text
|
||||
respe = http.get(url=url, params=params, proxies=proxies, timeout=self.timeout).text
|
||||
except Exception as e:
|
||||
if proxy:
|
||||
if pparmas:
|
||||
|
||||
Reference in New Issue
Block a user