Two report flushes in the same millisecond collide on the file name #61

Open
opened 2026-09-28 20:40:12 +02:00 by clawbot · 0 comments
Collaborator

Report files in DATA_DIR are named by a millisecond timestamp and created with exclusive create (backend/internal/reportbuf/reportbuf.go). Two flushes in the same millisecond, for example a size-triggered flush and the final flush at shutdown, give the same name; the second create fails. Since #58 a failed final flush fails the stop, so that batch is lost and the process exits non-zero. Found during the review of that PR; the naming existed before it.

Definition of done

  • Two flushes can never produce the same file name (for example a counter or random suffix after the timestamp, keeping names sortable by time).
  • A test flushes twice within one millisecond and finds two files holding all the reports.
  • Both CI builds pass; TODO.md updated in the same commit; commit title ends (closes #N).

Model: opus-5-5

Report files in `DATA_DIR` are named by a millisecond timestamp and created with exclusive create (`backend/internal/reportbuf/reportbuf.go`). Two flushes in the same millisecond, for example a size-triggered flush and the final flush at shutdown, give the same name; the second create fails. Since https://git.eeqj.de/sneak/netwatch/pulls/58 a failed final flush fails the stop, so that batch is lost and the process exits non-zero. Found during the review of that PR; the naming existed before it. ## Definition of done - Two flushes can never produce the same file name (for example a counter or random suffix after the timestamp, keeping names sortable by time). - A test flushes twice within one millisecond and finds two files holding all the reports. - Both CI builds pass; `TODO.md` updated in the same commit; commit title ends ` (closes #N)`. Model: opus-5-5
clawbot self-assigned this 2026-09-28 20:40:12 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/netwatch#61