mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
Perf: Enhance timeout handling. (#8826)
### What problem does this PR solve? ### Type of change - [x] Performance Improvement
This commit is contained in:
@ -20,6 +20,7 @@ import trio
|
||||
|
||||
from api import settings
|
||||
from api.utils import get_uuid
|
||||
from api.utils.api_utils import timeout
|
||||
from graphrag.light.graph_extractor import GraphExtractor as LightKGExt
|
||||
from graphrag.general.graph_extractor import GraphExtractor as GeneralKGExt
|
||||
from graphrag.general.community_reports_extractor import CommunityReportsExtractor
|
||||
@ -123,6 +124,7 @@ async def run_graphrag(
|
||||
return
|
||||
|
||||
|
||||
@timeout(60*60*2)
|
||||
async def generate_subgraph(
|
||||
extractor: Extractor,
|
||||
tenant_id: str,
|
||||
@ -194,6 +196,8 @@ async def generate_subgraph(
|
||||
callback(msg=f"generated subgraph for doc {doc_id} in {now - start:.2f} seconds.")
|
||||
return subgraph
|
||||
|
||||
|
||||
@timeout(60*3)
|
||||
async def merge_subgraph(
|
||||
tenant_id: str,
|
||||
kb_id: str,
|
||||
@ -225,6 +229,7 @@ async def merge_subgraph(
|
||||
return new_graph
|
||||
|
||||
|
||||
@timeout(60*60)
|
||||
async def resolve_entities(
|
||||
graph,
|
||||
subgraph_nodes: set[str],
|
||||
@ -250,6 +255,7 @@ async def resolve_entities(
|
||||
callback(msg=f"Graph resolution done in {now - start:.2f}s.")
|
||||
|
||||
|
||||
@timeout(60*30)
|
||||
async def extract_community(
|
||||
graph,
|
||||
tenant_id: str,
|
||||
|
||||
Reference in New Issue
Block a user