From ef4cb0536af061029939eb215d9e71601341dc1c Mon Sep 17 00:00:00 2001 From: 16337 <1633794139@qq.com> Date: Fri, 20 Mar 2026 22:48:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E5=90=AF=E5=8A=A8?= =?UTF-8?q?=E6=97=B6=E6=B8=85=E9=99=A4=E7=B3=BB=E7=BB=9F=E4=BB=A3=E7=90=86?= =?UTF-8?q?=E7=8E=AF=E5=A2=83=E5=8F=98=E9=87=8F=EF=BC=8C=E9=98=B2=E6=AD=A2?= =?UTF-8?q?=20Clash=20=E5=B9=B2=E6=89=B0=20Redis=20=E8=BF=9E=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Clash 代理会拦截 Redis 的 TCP 长连接导致频繁断连。 在 main.py 和 config_sync.py 模块加载时清除所有代理环境变量。 --- core/config_sync.py | 4 ++++ main.py | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/core/config_sync.py b/core/config_sync.py index e20d02d..8db730e 100644 --- a/core/config_sync.py +++ b/core/config_sync.py @@ -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 diff --git a/main.py b/main.py index c4dd923..989b727 100644 --- a/main.py +++ b/main.py @@ -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