yangdx commited on
Commit
05e2811
·
1 Parent(s): 2af3623

Change get_by_id batch size from 25 to 5 to reserve db connection resouces

Browse files
Files changed (2) hide show
  1. lightrag/kg/redis_impl.py +3 -3
  2. lightrag/operate.py +1 -1
lightrag/kg/redis_impl.py CHANGED
@@ -9,9 +9,9 @@ if not pm.is_installed("redis"):
9
  pm.install("redis")
10
 
11
  # aioredis is a depricated library, replaced with redis
12
- from redis.asyncio import Redis, ConnectionPool
13
- from redis.exceptions import RedisError, ConnectionError
14
- from lightrag.utils import logger, compute_mdhash_id
15
 
16
  from lightrag.base import BaseKVStorage
17
  import json
 
9
  pm.install("redis")
10
 
11
  # aioredis is a depricated library, replaced with redis
12
+ from redis.asyncio import Redis, ConnectionPool # type: ignore
13
+ from redis.exceptions import RedisError, ConnectionError # type: ignore
14
+ from lightrag.utils import logger
15
 
16
  from lightrag.base import BaseKVStorage
17
  import json
lightrag/operate.py CHANGED
@@ -1395,7 +1395,7 @@ async def _find_most_related_text_unit_from_entities(
1395
  tasks.append((c_id, index, this_edges))
1396
 
1397
  # Process in batches of 25 tasks at a time to avoid overwhelming resources
1398
- batch_size = 25
1399
  results = []
1400
 
1401
  for i in range(0, len(tasks), batch_size):
 
1395
  tasks.append((c_id, index, this_edges))
1396
 
1397
  # Process in batches of 25 tasks at a time to avoid overwhelming resources
1398
+ batch_size = 5
1399
  results = []
1400
 
1401
  for i in range(0, len(tasks), batch_size):