Commit cdcfc58
fix: drain buffered ACKs when errorsCh closes before acksCh (#258)
closes #233
## Summary
- `readAcksLoop` defers `close(errorsCh)` before `close(acksCh)` (LIFO),
so `errorsCh` closes first.
- The `select` in `readAcks` could non-deterministically pick the closed
`errorsCh` and return, abandoning buffered ACKs in `acksCh` (buffer size
20).
- Lost ACKs leave successful appends in `inflightQueue`, which then time
out and get retried on a new session, causing data duplication.
- Fix: drain `acksCh` when `errorsCh` closes to process all pending ACKs
before returning.
## Test plan
- [ ] Verify `go build ./...` passes
- [ ] Confirm that under high-throughput pipelined appends, session
teardown does not lose buffered ACKs
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 0da4976 commit cdcfc58
1 file changed
+5
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
423 | 423 | | |
424 | 424 | | |
425 | 425 | | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
426 | 431 | | |
427 | 432 | | |
428 | 433 | | |
| |||
0 commit comments