修复:启动时清除系统代理环境变量,防止 Clash 干扰 Redis 连接

Clash 代理会拦截 Redis 的 TCP 长连接导致频繁断连。
在 main.py 和 config_sync.py 模块加载时清除所有代理环境变量。
This commit is contained in:
2026-03-20 22:48:09 +08:00
parent 06b397044e
commit ef4cb0536a
2 changed files with 8 additions and 0 deletions

View File

@@ -16,6 +16,10 @@ import logging
import os
import platform
import socket
# 禁用系统代理Clash 等代理工具会干扰 Redis TCP 长连接)
for key in ("http_proxy", "https_proxy", "HTTP_PROXY", "HTTPS_PROXY", "all_proxy", "ALL_PROXY"):
os.environ.pop(key, None)
import threading
import time
from datetime import datetime

View File

@@ -12,6 +12,10 @@ import time
from datetime import datetime
from typing import Dict, Any, Optional, List, Tuple
# 禁用系统代理Clash 等代理工具会干扰 Redis TCP 长连接和 HTTP 请求)
for _key in ("http_proxy", "https_proxy", "HTTP_PROXY", "HTTPS_PROXY", "all_proxy", "ALL_PROXY"):
os.environ.pop(_key, None)
from config.settings import get_settings, Settings
from core.config_sync import get_config_sync_manager, ConfigSyncManager
from core.debug_http_server import start_debug_http_server