fix(storage): check error returns from MemLanceClient in SQLiteMemClient

SQLiteMemClient.IncrementUseful/IncrementNotUseful were discarding the
error return of MemLanceClient.IncrementUseful/IncrementNotUseful.
Since the latter now return real errors (6e67f3e), dropping them
re-introduces the silent-failure class of bug we just fixed across
the Rust path. Also propagate persistMemory errors.
This commit is contained in:
小唯
2026-09-20 11:39:30 +08:00
parent 6e67f3e33f
commit b5f59703ab
+8 -4
View File
@@ -280,23 +280,27 @@ func (sm *SQLiteMemClient) UpdateMemoryContent(id, newContent, source string) er
}
func (sm *SQLiteMemClient) IncrementUseful(id string) error {
sm.MemLanceClient.IncrementUseful(id)
if err := sm.MemLanceClient.IncrementUseful(id); err != nil {
return err
}
sm.mu.RLock()
e := sm.memories[id]
sm.mu.RUnlock()
if e != nil {
sm.persistMemory(e)
return sm.persistMemory(e)
}
return nil
}
func (sm *SQLiteMemClient) IncrementNotUseful(id string) error {
sm.MemLanceClient.IncrementNotUseful(id)
if err := sm.MemLanceClient.IncrementNotUseful(id); err != nil {
return err
}
sm.mu.RLock()
e := sm.memories[id]
sm.mu.RUnlock()
if e != nil {
sm.persistMemory(e)
return sm.persistMemory(e)
}
return nil
}