deploy: auto commit server changes 2026-06-11 21:47:23
This commit is contained in:
@@ -18,6 +18,7 @@ from typing import Any, Dict, Iterable, List, Optional
|
||||
import aiohttp
|
||||
import aiomysql
|
||||
import redis.asyncio as aioredis
|
||||
import redis.exceptions as redis_exceptions
|
||||
from loguru import logger
|
||||
|
||||
|
||||
@@ -592,6 +593,10 @@ class KbWorker:
|
||||
password=redis_cfg.password or None,
|
||||
db=redis_cfg.db,
|
||||
decode_responses=True,
|
||||
socket_connect_timeout=5,
|
||||
socket_timeout=max(10, int(self.block_ms / 1000) + 5),
|
||||
health_check_interval=30,
|
||||
retry_on_timeout=True,
|
||||
)
|
||||
self.db = KbDatabase()
|
||||
self.embedder = EmbeddingClient()
|
||||
@@ -612,7 +617,11 @@ class KbWorker:
|
||||
await self.ensure_group()
|
||||
logger.info("KB worker started id={} batch={} block_ms={}", self.worker_id, self.batch, self.block_ms)
|
||||
while True:
|
||||
await self.consume_once()
|
||||
try:
|
||||
await self.consume_once()
|
||||
except (redis_exceptions.TimeoutError, redis_exceptions.ConnectionError, asyncio.TimeoutError) as exc:
|
||||
logger.warning("redis read interrupted, continue polling: {}", exc)
|
||||
await asyncio.sleep(1)
|
||||
|
||||
async def consume_once(self) -> int:
|
||||
rows = await self.redis.xreadgroup(
|
||||
|
||||
Reference in New Issue
Block a user