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 aiohttp
|
||||||
import aiomysql
|
import aiomysql
|
||||||
import redis.asyncio as aioredis
|
import redis.asyncio as aioredis
|
||||||
|
import redis.exceptions as redis_exceptions
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
|
|
||||||
|
|
||||||
@@ -592,6 +593,10 @@ class KbWorker:
|
|||||||
password=redis_cfg.password or None,
|
password=redis_cfg.password or None,
|
||||||
db=redis_cfg.db,
|
db=redis_cfg.db,
|
||||||
decode_responses=True,
|
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.db = KbDatabase()
|
||||||
self.embedder = EmbeddingClient()
|
self.embedder = EmbeddingClient()
|
||||||
@@ -612,7 +617,11 @@ class KbWorker:
|
|||||||
await self.ensure_group()
|
await self.ensure_group()
|
||||||
logger.info("KB worker started id={} batch={} block_ms={}", self.worker_id, self.batch, self.block_ms)
|
logger.info("KB worker started id={} batch={} block_ms={}", self.worker_id, self.batch, self.block_ms)
|
||||||
while True:
|
while True:
|
||||||
|
try:
|
||||||
await self.consume_once()
|
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:
|
async def consume_once(self) -> int:
|
||||||
rows = await self.redis.xreadgroup(
|
rows = await self.redis.xreadgroup(
|
||||||
|
|||||||
Reference in New Issue
Block a user