Reduce proxy check timeout

This commit is contained in:
Nexus 2023-11-06 20:31:10 +00:00
parent 708f6810c4
commit e00faf23a5
Signed by: nex
GPG key ID: 0FA334385D0B689F
2 changed files with 2 additions and 4 deletions

View file

@ -1,5 +1,3 @@
{ {
"python.linting.pycodestyleEnabled": true,
"python.linting.enabled": true,
"python.analysis.typeCheckingMode": "basic" "python.analysis.typeCheckingMode": "basic"
} }

View file

@ -854,13 +854,13 @@ class OtherCog(commands.Cog):
@staticmethod @staticmethod
async def check_proxy(url: str = "socks5://localhost:1090"): async def check_proxy(url: str = "socks5://localhost:1090"):
client = httpx.AsyncClient(http2=True) client = httpx.AsyncClient(http2=True, timeout=3)
my_ip4 = (await client.get("https://api.ipify.org")).text my_ip4 = (await client.get("https://api.ipify.org")).text
real_ips = [my_ip4] real_ips = [my_ip4]
await client.aclose() await client.aclose()
# Check the proxy # Check the proxy
client = httpx.AsyncClient(http2=True, proxies=url) client = httpx.AsyncClient(http2=True, proxies=url, timeout=3)
try: try:
response = await client.get( response = await client.get(
"https://1.1.1.1/cdn-cgi/trace", "https://1.1.1.1/cdn-cgi/trace",