fetch_messages N+1 across full DB #53

Closed
opened 2026-04-19 08:25:35 +00:00 by zaelgohary · 1 comment
Member

fetch_messages called chatmessage_list() (returns every SID in the domain), then issued a chatmessage_get() per SID, then discarded messages whose conversation_sid didn't match. Opening any chat was O(total messages in DB) round trips even though the conversation typically owns a small fraction of them.

Fix: switch to the new server-side ConversationService.list_messages(conversation_sid) RPC in hero_osis (see companion ticket in hero_osis). Client is now a single call that returns the filtered, sorted message list.

`fetch_messages` called `chatmessage_list()` (returns every SID in the domain), then issued a `chatmessage_get()` per SID, then discarded messages whose `conversation_sid` didn't match. Opening any chat was O(total messages in DB) round trips even though the conversation typically owns a small fraction of them. **Fix**: switch to the new server-side `ConversationService.list_messages(conversation_sid)` RPC in hero_osis (see companion ticket in hero_osis). Client is now a single call that returns the filtered, sorted message list.
zaelgohary changed title from perf: fetch_messages fetches every message in the DB then filters client-side to fetch_messages N+1 across full DB 2026-04-19 08:32:20 +00:00
Author
Member

Fixed by #56.

Fixed by https://forge.ourworld.tf/lhumina_code/hero_archipelagos/pulls/56.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lhumina_code/hero_archipelagos#53
No description provided.