From b45c5f930472f63a4ebee15aeb695a125562b5e7 Mon Sep 17 00:00:00 2001 From: yangdx Date: Sun, 6 Apr 2025 17:42:13 +0800 Subject: [PATCH] Change get_by_id batch size from 25 to 5 to reserve db connection resouces --- lightrag/kg/redis_impl.py | 6 +++--- lightrag/operate.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lightrag/kg/redis_impl.py b/lightrag/kg/redis_impl.py index 38a12ab5..db343dee 100644 --- a/lightrag/kg/redis_impl.py +++ b/lightrag/kg/redis_impl.py @@ -9,9 +9,9 @@ if not pm.is_installed("redis"): pm.install("redis") # aioredis is a depricated library, replaced with redis -from redis.asyncio import Redis, ConnectionPool -from redis.exceptions import RedisError, ConnectionError -from lightrag.utils import logger, compute_mdhash_id +from redis.asyncio import Redis, ConnectionPool # type: ignore +from redis.exceptions import RedisError, ConnectionError # type: ignore +from lightrag.utils import logger from lightrag.base import BaseKVStorage import json diff --git a/lightrag/operate.py b/lightrag/operate.py index 97eccca0..1e023004 100644 --- a/lightrag/operate.py +++ b/lightrag/operate.py @@ -1395,7 +1395,7 @@ async def _find_most_related_text_unit_from_entities( tasks.append((c_id, index, this_edges)) # Process in batches of 25 tasks at a time to avoid overwhelming resources - batch_size = 25 + batch_size = 5 results = [] for i in range(0, len(tasks), batch_size):