mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-09 13:01:00 +00:00
The admin upload streamed only the measurements while it checked a file, so a document-heavy account copy was held whole in memory and an upload of a few hundred megabytes could take the process down. The sections a reader takes an element at a time are now named once (BACKUP_STREAMED_SECTIONS in streamed-backup.ts): measurements, intake events, mood entries, documents and ECG recordings. The upload reads its file through readStreamedBackup like the restore and the preview, and the restore drill and the restore script use the same key set. A behavioural test pushes a 271 MB document-heavy file through the real upload route and fails when the heap grows with the file. The stream guard now asserts that every reader goes through the shared reader or key set and that no file declares its own.