Fix memory issue on Infinity 0.6.15 (#12258)

### What problem does this PR solve?

1. Remove unused columns
2. Check the empty database
3. Switch on the order by expression

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)

---------

Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
Jin Hai
2025-12-27 20:25:06 +08:00
committed by GitHub
parent 050534e743
commit ef5341b664
3 changed files with 14 additions and 27 deletions

View File

@ -168,7 +168,7 @@ class MessageService:
order_by = OrderByExpr()
order_by.desc("valid_at")
res = settings.msgStoreConn.search(
res, count = settings.msgStoreConn.search(
select_fields=["memory_id", "content", "content_embed"],
highlight_fields=[],
condition={},
@ -177,8 +177,10 @@ class MessageService:
offset=0, limit=2048*len(memory_ids),
index_names=index_names, memory_ids=memory_ids, agg_fields=[], hide_forgotten=False
)
if not res:
if count == 0:
return {}
docs = settings.msgStoreConn.get_fields(res, ["memory_id", "content", "content_embed"])
size_dict = {}
for doc in docs.values():