Skip to content

Commit 361a297

Browse files
Copilotlstein
andcommitted
Address code review feedback: improve comments and remove redundant timestamp update
Co-authored-by: lstein <[email protected]>
1 parent 714f855 commit 361a297

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

invokeai/app/services/client_state_persistence/client_state_persistence_sqlite.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
class ClientStatePersistenceSqlite(ClientStatePersistenceABC):
77
"""
8-
SQLite implementation for client persistence.
9-
This class stores client data per user to prevent data leakage between users.
8+
SQLite implementation for client state persistence.
9+
This class stores client state data per user to prevent data leakage between users.
1010
"""
1111

1212
def __init__(self, db: SqliteDatabase) -> None:
@@ -23,8 +23,7 @@ def set_by_key(self, user_id: str, key: str, value: str) -> str:
2323
INSERT INTO client_state (user_id, key, value)
2424
VALUES (?, ?, ?)
2525
ON CONFLICT(user_id, key) DO UPDATE
26-
SET value = excluded.value,
27-
updated_at = CURRENT_TIMESTAMP;
26+
SET value = excluded.value;
2827
""",
2928
(user_id, key, value),
3029
)

invokeai/app/services/shared/sqlite_migrator/migrations/migration_26.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ def _update_client_state_table(self, cursor: sqlite3.Cursor) -> None:
9797
)
9898

9999
# Migrate existing data to 'system' user
100+
# The 'system' user is created by migration 25, so it's guaranteed to exist at this point
100101
for key, value in existing_data.items():
101102
cursor.execute(
102103
"""

tests/app/routers/test_client_state_multiuser.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,10 @@ def test_update_existing_key(client: TestClient, admin_token: str):
244244

245245
def test_complex_json_values(client: TestClient, admin_token: str):
246246
"""Test that complex JSON values can be stored and retrieved."""
247-
complex_value = '{"params": {"model": "test-model", "steps": 50}, "prompt": "a beautiful landscape"}'
247+
import json
248+
249+
complex_dict = {"params": {"model": "test-model", "steps": 50}, "prompt": "a beautiful landscape"}
250+
complex_value = json.dumps(complex_dict)
248251

249252
# Set complex value
250253
set_response = client.post(

0 commit comments

Comments
 (0)