mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 01:10:23 +08:00
fix: 优化 Redis 连接超时的错误日志输出
将 Redis 超时和连接错误改为 WARNING 级别的简短日志, 避免系统休眠恢复时打印大量堆栈信息。
This commit is contained in:
@@ -14,7 +14,9 @@ import socket
|
|||||||
import time
|
import time
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
|
from redis.exceptions import ConnectionError as RedisConnectionError
|
||||||
from redis.exceptions import ResponseError
|
from redis.exceptions import ResponseError
|
||||||
|
from redis.exceptions import TimeoutError as RedisTimeoutError
|
||||||
from sqlalchemy.exc import IntegrityError
|
from sqlalchemy.exc import IntegrityError
|
||||||
from sqlalchemy.orm import Session
|
from sqlalchemy.orm import Session
|
||||||
|
|
||||||
@@ -176,6 +178,9 @@ class UsageQueueConsumer:
|
|||||||
await self._log_metrics(redis_client)
|
await self._log_metrics(redis_client)
|
||||||
except asyncio.CancelledError:
|
except asyncio.CancelledError:
|
||||||
break
|
break
|
||||||
|
except (RedisTimeoutError, RedisConnectionError) as exc:
|
||||||
|
logger.warning(f"[usage-queue] Redis connection issue: {exc}")
|
||||||
|
await asyncio.sleep(1)
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
logger.exception(f"[usage-queue] Consumer loop error: {exc}")
|
logger.exception(f"[usage-queue] Consumer loop error: {exc}")
|
||||||
await asyncio.sleep(1)
|
await asyncio.sleep(1)
|
||||||
|
|||||||
Reference in New Issue
Block a user