mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #7445] Exporting a very long chat freezes the server for seconds #4148
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#4148
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @SpicyMarinara on GitHub (Oct 11, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/7445
Originally assigned to: @SpicyMarinara on GitHub.
Problem
Exporting a very long chat freezes the whole server while the export is built. Other tabs, other users and live generation streams get no answer until it finishes.
Measured over real HTTP against staging with
GET /api/chats/:id/export?format=jsonl:A concurrent ping waited the whole 20 s, so the event loop never yielded. The result is the same with or without compression, which adds only about 0.2 s.
Likely cause (traced, not profiled)
serializeChatTranscript(packages/server/src/routes/chats.routes.ts, around line 4752, with the same pattern near line 5052) awaitsstorage.getSwipes(msg.id)once per message. That runs a filtered select on the file-backed store each time. The store resolves without real I/O, so the awaits never let other work run. A batch helper already exists:listSwipesByMessageIdsinservices/storage/chats.storage.ts.Expected
An export of any size doesn't block other requests for more than a moment. Read the swipes in one batch, and if needed yield between chunks.
Found while verifying #7441 / #7444.
@SpicyMarinara commented on GitHub (Oct 11, 2026):
Working on this in branch fix/chat-export-freeze (Claude Code agent for @SpicyMarinara).