🐛 recover orphaned .tmp batch files on init#104
Conversation
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 83e9f36cd2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
83e9f36 to
8a3624c
Compare
- Extract renameBatchFile() and reuse in rotateBatch() and new rotateOrphanedBatches() - Scan track directory for leftover .tmp files on create and rotate them to .log - Replace no-op flush() call with rotateOrphanedBatches() in create()
96eaa08 to
add467c
Compare
add467c to
c76a63f
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c76a63f482
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Motivation
Cf #103. When the app crashes or exits abruptly, events buffered in
.tmpbatch files are never uploaded on the next launch. They accumulate on disk across sessions, leading to silent data loss and unbounded disk usage.Diagnostic:
BatchProducer.create()calledflush()on init, butflush()only rotates the current in-memory batch reference, which isnullon a fresh instance. Orphaned.tmpfiles from prior sessions were invisible toBatchConsumer(which only picks up.logfiles).Changes
rotateOrphanedBatches()toBatchProducer: scans the track directory on init and renames leftover.tmpfiles to.logrenameBatchFile()method, reused by bothrotateBatch()androtateOrphanedBatches()flush()call increate()withrotateOrphanedBatches()userDatadirectory via--user-data-dir, preventing cross-test data pollution from recovered orphaned filesTest instructions
.tmp-only filtering, graceful handling of readdir/rename failures.tmpfiles in<userData>/rum/, restart the SDK, verify they are renamed to.logand uploadedChecklist