From c4998d0e0978ac98fd869d3bb4dddd47c198bc08 Mon Sep 17 00:00:00 2001 From: Zhichang Yu Date: Wed, 26 Mar 2025 23:48:47 +0800 Subject: [PATCH] Rename graphrag task lock (#6576) ### What problem does this PR solve? Rename graphrag task lock ### Type of change - [x] Refactoring --- graphrag/general/index.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/graphrag/general/index.py b/graphrag/general/index.py index 8b41eb5cc..2b4a66db5 100644 --- a/graphrag/general/index.py +++ b/graphrag/general/index.py @@ -190,7 +190,7 @@ async def merge_subgraph( embedding_model, callback, ): - graphrag_task_lock = RedisDistributedLock("graphrag_task", lock_value=doc_id, timeout=600) + graphrag_task_lock = RedisDistributedLock(f"graphrag_task_{kb_id}", lock_value=doc_id, timeout=600) while True: if graphrag_task_lock.acquire(): break @@ -230,10 +230,11 @@ async def resolve_entities( embed_bdl, callback, ): - graphrag_task_lock = RedisDistributedLock("graphrag_task", lock_value=doc_id, timeout=600) + graphrag_task_lock = RedisDistributedLock(f"graphrag_task_{kb_id}", lock_value=doc_id, timeout=600) while True: if graphrag_task_lock.acquire(): break + callback(msg=f"resolve_entities {doc_id} is waiting graphrag_task_lock") await trio.sleep(10) start = trio.current_time() @@ -261,10 +262,11 @@ async def extract_community( embed_bdl, callback, ): - graphrag_task_lock = RedisDistributedLock("graphrag_task", lock_value=doc_id, timeout=600) + graphrag_task_lock = RedisDistributedLock(f"graphrag_task_{kb_id}", lock_value=doc_id, timeout=600) while True: if graphrag_task_lock.acquire(): break + callback(msg=f"extract_community {doc_id} is waiting graphrag_task_lock") await trio.sleep(10) start = trio.current_time()