perf(dashboard): keyset pagination for streaming session export

OFFSET paging made the streaming export O(n^2) on huge transcripts;
after_id keyset paging keeps each page seek O(1). Adds after_id to
SessionDB.get_messages (ascending-only, guarded against latest/offset
combos).
This commit is contained in:
kshitij
2026-08-08 00:43:45 +05:30
parent 5b4b9bbf77
commit e8b05dc6c2
4 changed files with 32 additions and 5 deletions
+1 -1
View File
@@ -1895,7 +1895,7 @@ class TestWebServerEndpoints:
original_get_messages = SessionDB.get_messages
def tracked_get_messages(self, session_id, *args, **kwargs):
calls.append((kwargs.get("limit"), kwargs.get("offset")))
calls.append((kwargs.get("limit"), kwargs.get("after_id")))
return original_get_messages(self, session_id, *args, **kwargs)
monkeypatch.setattr(SessionDB, "get_messages", tracked_get_messages)