Skip to content

Commit 9e747cc

Browse files
author
raold
committed
fix: Add save_to_disk method to MockStorage
- Fixed AttributeError when API shuts down with mock storage - MockStorage now has public async save_to_disk method - Periodic persistence works correctly with mock backend
1 parent bf8863c commit 9e747cc

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

.claude/settings.local.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,8 @@
150150
"Bash(--notes-file RELEASE_NOTES_v4.2.3.md)",
151151
"Bash(tree:*)",
152152
"Bash(kill:*)",
153-
"Bash(bash:*)"
153+
"Bash(bash:*)",
154+
"Bash(USE_MOCK_DB=true timeout 5 .venv/bin/uvicorn app.main:app --port 8001)"
154155
],
155156
"deny": []
156157
}

app/storage/mock_storage.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ def _save_to_disk(self):
4343
except Exception as e:
4444
print(f"⚠️ Could not save memories: {e}")
4545

46+
async def save_to_disk(self):
47+
"""Public async method for periodic persistence"""
48+
self._save_to_disk()
49+
4650
async def create_memory(self, data: Dict) -> Dict:
4751
"""Create a new memory"""
4852
memory_id = str(uuid.uuid4())

0 commit comments

Comments
 (0)