优化:Redis 连接增强 — TCP keepalive 适配 + 截图处理器独立重连
- 新增 _build_keepalive_options() 适配 Linux/Windows TCP keepalive - health_check_interval 30→15秒,更快发现断连 - 截图处理器新增 _reconnect_cloud_redis() 独立重连能力 - 截图监听捕获 ConnectionError 主动重连,不再退避到60秒
This commit is contained in:
4
main.py
4
main.py
@@ -191,6 +191,7 @@ class EdgeInferenceService:
|
||||
try:
|
||||
import redis
|
||||
cfg = self._settings.cloud_redis
|
||||
from core.config_sync import _build_keepalive_options
|
||||
cloud_redis = redis.Redis(
|
||||
host=cfg.host,
|
||||
port=cfg.port,
|
||||
@@ -201,7 +202,8 @@ class EdgeInferenceService:
|
||||
socket_timeout=10,
|
||||
retry_on_timeout=True,
|
||||
socket_keepalive=True,
|
||||
health_check_interval=30,
|
||||
socket_keepalive_options=_build_keepalive_options(),
|
||||
health_check_interval=15,
|
||||
)
|
||||
cloud_redis.ping()
|
||||
self._logger.info(f"截图处理器独立连接云端 Redis 成功: {cfg.host}:{cfg.port}/{cfg.db}")
|
||||
|
||||
Reference in New Issue
Block a user