Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

fix: Fix the problem that concurrent execution limit in task executor fails and causes OOM (issue#7580) (#7700)

S0b3Rr5d21cc3660b8
diff --git a/rag/svr/task_executor.py b/rag/svr/task_executor.py
index 51de6950bc..6448c4e81e 100644
--- a/rag/svr/task_executor.py
+++ b/rag/svr/task_executor.py
@@ -713,7 +713,10 @@ def recover_pending_tasks():
redis_lock.release()
stop_event.wait(60)
-
+async def task_manager():
+ global task_limiter
+ async with task_limiter:
+ await handle_task()
async def main():
@@ -742,8 +745,8 @@ async def main():
async with trio.open_nursery() as nursery:
nursery.start_soon(report_status)
while not stop_event.is_set():
- async with task_limiter:
- nursery.start_soon(handle_task)
+ nursery.start_soon(task_manager)
+ await trio.sleep(0.1)
logging.error("BUG!!! You should not reach here!!!")
if __name__ == "__main__":