fix(douyu): 修复斗鱼链路 P0/P1 隐患并增强 P2 运维队列可观测性
This commit is contained in:
@@ -102,10 +102,11 @@ class XkdailiAdapter(BaseWhitelistAdapter):
|
||||
"""添加IP到白名单。多个IP用英文逗号隔开。"""
|
||||
try:
|
||||
url = self._build_url(type="addwhiteip", ip=ip)
|
||||
response = requests.get(url, timeout=10)
|
||||
response.raise_for_status()
|
||||
|
||||
text = response.text.strip()
|
||||
with requests.Session() as sess:
|
||||
sess.trust_env = False
|
||||
with sess.get(url, timeout=10) as response:
|
||||
response.raise_for_status()
|
||||
text = response.text.strip()
|
||||
logger.debug(f"星空添加白名单响应: {text}")
|
||||
|
||||
ok, msg = self._parse_response(text)
|
||||
@@ -123,10 +124,11 @@ class XkdailiAdapter(BaseWhitelistAdapter):
|
||||
"""删除白名单IP。多个IP用英文逗号隔开。"""
|
||||
try:
|
||||
url = self._build_url(type="delwhiteip", ip=ip)
|
||||
response = requests.get(url, timeout=10)
|
||||
response.raise_for_status()
|
||||
|
||||
text = response.text.strip()
|
||||
with requests.Session() as sess:
|
||||
sess.trust_env = False
|
||||
with sess.get(url, timeout=10) as response:
|
||||
response.raise_for_status()
|
||||
text = response.text.strip()
|
||||
logger.debug(f"星空删除白名单响应: {text}")
|
||||
|
||||
ok, msg = self._parse_response(text)
|
||||
@@ -145,10 +147,11 @@ class XkdailiAdapter(BaseWhitelistAdapter):
|
||||
try:
|
||||
# 尝试添加无效IP来验证认证
|
||||
url = self._build_url(type="addwhiteip", ip="0.0.0.0")
|
||||
response = requests.get(url, timeout=10)
|
||||
response.raise_for_status()
|
||||
|
||||
text = response.text.strip()
|
||||
with requests.Session() as sess:
|
||||
sess.trust_env = False
|
||||
with sess.get(url, timeout=10) as response:
|
||||
response.raise_for_status()
|
||||
text = response.text.strip()
|
||||
ok, msg = self._parse_response(text)
|
||||
|
||||
if ok:
|
||||
|
||||
Reference in New Issue
Block a user