RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.
Go agent-harnessagent-native-databaseagentic-aiagentic-retrievalagentic-searchaiai-agentscontext-enginecontext-engineeringcontext-managementharness-engineeringknowledge-compilationragretrieval-augmented-generationretrieval-harnesssearch-harness
Fix get_unacked_iterator (#6280)
Zhichang Yubb869aca33fc
diff --git a/rag/svr/task_executor.py b/rag/svr/task_executor.pyindex f353c44a44..e8ccb5be9b 100644--- a/rag/svr/task_executor.py+++ b/rag/svr/task_executor.py@@ -592,6 +592,7 @@ async def handle_task():global DONE_TASKS, FAILED_TASKSredis_msg, task = await collect()if not task:+ await trio.sleep(5)returntry:logging.info(f"handle_task begin for task {json.dumps(task)}")diff --git a/rag/utils/redis_conn.py b/rag/utils/redis_conn.pyindex 98a152c897..a83febbed3 100644--- a/rag/utils/redis_conn.py+++ b/rag/utils/redis_conn.py@@ -209,7 +209,7 @@ class RedisDB:"""https://redis.io/docs/latest/commands/xreadgroup/"""try:group_info = self.REDIS.xinfo_groups(queue_name)- if not any(e["name"] == group_name for e in group_info):+ if not any(gi["name"] == group_name for gi in group_info):self.REDIS.xgroup_create(queue_name, group_name, id="0", mkstream=True)args = {"groupname": group_name,@@ -228,7 +228,7 @@ class RedisDB:res = RedisMsg(self.REDIS, queue_name, group_name, msg_id, payload)return resexcept Exception as e:- if "key" in str(e):+ if str(e) == 'no such key':passelse:logging.exception(@@ -242,8 +242,14 @@ class RedisDB:def get_unacked_iterator(self, queue_names: list[str], group_name, consumer_name):try:for queue_name in queue_names:- group_info = self.REDIS.xinfo_groups(queue_name)- if not any(e["name"] == group_name for e in group_info):+ try:+ group_info = self.REDIS.xinfo_groups(queue_name)+ except Exception as e:+ if str(e) == 'no such key':+ logging.warning(f"RedisDB.get_unacked_iterator queue {queue_name} doesn't exist")+ continue+ if not any(gi["name"] == group_name for gi in group_info):+ logging.warning(f"RedisDB.get_unacked_iterator queue {queue_name} group {group_name} doesn't exist")continuecurrent_min = 0while True:@@ -251,13 +257,11 @@ class RedisDB:if not payload:breakcurrent_min = payload.get_msg_id()- logging.info(f"RedisDB.get_unacked_iterator {consumer_name} msg_id {current_min}")+ logging.info(f"RedisDB.get_unacked_iterator {queue_name} {consumer_name} {current_min}")yield payload- except Exception as e:- if "key" in str(e):- return+ except Exception:logging.exception(- "RedisDB.get_unacked_iterator " + consumer_name + " got exception: "+ "RedisDB.get_unacked_iterator got exception: ")self.__open__()