ragflow/api/db/services
Yongteng Lei cdac51f145
Fix: Redis stream lag can be nil (#9139)
### What problem does this PR solve?

```bash
Traceback (most recent call last):
  File "/home/infiniflow/workspace/ragflow/api/db/services/document_service.py", line 635, in update_progress
    info["progress_msg"] = "%d tasks are ahead in the queue..."%get_queue_length(priority)
  File "/home/infiniflow/workspace/ragflow/api/db/services/document_service.py", line 686, in get_queue_length
    return int(group_info.get("lag", 0))
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'
```
This issue can happen very rare. When a `stream` is first created, the
`lag` value may be nil, which can cause this issue. However, once any
message is synced, the `lag` will become `0` afterwards.

```bash
> XINFO GROUPS rag_flow_svr_queue
1)  1) "name"
    2) "rag_flow_svr_task_broker"
    3) "consumers"
    4) (integer) 0
    5) "pending"
    6) (integer) 0
    7) "last-delivered-id"
    8) "1753952489937-0"
    9) "entries-read"
   10) (nil)
   11) "lag"
   12) (nil)
```

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
2025-08-01 09:39:41 +08:00
..
__init__.py Fix: patch regex vulnerability in filename handling (#7887) 2025-05-27 16:35:37 +08:00
api_service.py Feat: Redesign and refactor agent module (#9113) 2025-07-30 19:41:09 +08:00
canvas_service.py Feat: Redesign and refactor agent module (#9113) 2025-07-30 19:41:09 +08:00
common_service.py Fix: File selection in Retrieval testing causes other options to disappear (#7759) 2025-05-30 09:38:50 +08:00
conversation_service.py Fix:when stream=false,new message without sessionid does no (#8078) 2025-06-05 15:14:15 +08:00
dialog_service.py Perf: set timeout of some steps in KG. (#8873) 2025-07-16 18:06:03 +08:00
document_service.py Fix: Redis stream lag can be nil (#9139) 2025-08-01 09:39:41 +08:00
file2document_service.py Tagging (#4426) 2025-01-09 17:07:21 +08:00
file_service.py Feat: Redesign and refactor agent module (#9113) 2025-07-30 19:41:09 +08:00
knowledgebase_service.py Fix: filed_map was incorrectly persisted (#7443) 2025-05-06 09:44:38 +08:00
langfuse_service.py Feat: add Langfuse APIs (#6460) 2025-03-24 18:25:43 +08:00
llm_service.py Rafe: Update LLMService type hints (#9131) 2025-07-31 12:13:49 +08:00
mcp_server_service.py Feat: add MCP dashboard operations (#8460) 2025-06-25 09:26:04 +08:00
search_service.py Feat: wrap search app (#8320) 2025-06-18 16:45:42 +08:00
task_service.py Pref: use redis to check if canceled. (#8853) 2025-07-15 17:19:27 +08:00
user_canvas_version.py Feat: Improve 'user_canvan_version' delete and 'document' delete performance (#6553) 2025-05-07 10:55:08 +08:00
user_service.py Fix: Authentication Bypass via predictable JWT secret and empty token validation (#7998) 2025-06-05 12:10:24 +08:00