Conversation
88118d3 to
3374d12
Compare
b15a9cf to
c47ebae
Compare
Signed-off-by: Piotr Piotrowski <piotr@synadia.com>
Signed-off-by: Piotr Piotrowski <piotr@synadia.com>
…adata Signed-off-by: Piotr Piotrowski <piotr@synadia.com>
Signed-off-by: Piotr Piotrowski <piotr@synadia.com>
Signed-off-by: Piotr Piotrowski <piotr@synadia.com>
Signed-off-by: Piotr Piotrowski <piotr@synadia.com>
Signed-off-by: Piotr Piotrowski <piotr@synadia.com>
e144e89 to
a282c25
Compare
Signed-off-by: Piotr Piotrowski <piotr@synadia.com>
a282c25 to
0693565
Compare
|
@claude review this PR |
|
Claude finished @piotrpio's task in 3m 0s —— View job PR Review: Fast publish initial design
Overall this is a solid design for a fast-ingest batch publisher. The flow control mechanism (stall channel, ping/retry, server-driven frequency updates) is well thought out. A few issues found below, ranging from a timer leak to test bugs. Bugs1. case <-time.After(fp.opts.ackTimeout):
firstAckTimer := time.NewTimer(fp.opts.ackTimeout)
defer firstAckTimer.Stop()
// ...
case <-firstAckTimer.C:2. Test assertion mismatch — if fastAck.AckSequence != 0 {
t.Fatalf("Expected fastAck.AckSequence to be 1, got %d", fastAck.AckSequence)
}The condition checks
Given that the first message is acked synchronously before the second Add returns, 3. Wrong error description for ErrFastBatchNotEnabled jetstream.JetStreamError = &jsError{apiErr: &jetstream.APIError{..., Description: "batch publish not enabled on stream", ...}}This has the same description as Design / Behavioural Concerns4. Error handler called while holding The comment correctly warns about this, but the implication is significant: any call back into the 5. Empty-batch if fp.sequence == 0 {
fp.mu.Unlock()
return nil, errors.New("no messages in batch")
}Every other error in this package is a sentinel (exported 6. When the first-message ack times out, 7. Duplicate subscribe logic in
Minor / Nits8. Redundant double-set of if o.lastSubjectSeq != nil {
msg.Header.Set(jetstream.ExpectedLastSubjSeqHeader, ...)
}
if o.lastSubject != "" {
msg.Header.Set(jetstream.ExpectedLastSubjSeqSubjHeader, ...)
msg.Header.Set(jetstream.ExpectedLastSubjSeqHeader, ...) // sets same header again
}When both 9. Duplicate test error check — ack, err := batch.Close(context.Background())
if err != nil {
t.Fatalf("Unexpected error discarding batch: %v", err)
}
if err != nil { // ← dead code, always false here
t.Fatalf("Unexpected error committing batch: %v", err)
}The second 10.
|
Signed-off-by: Piotr Piotrowski <piotr@synadia.com>
89487ff to
29ea326
Compare
Signed-off-by: Piotr Piotrowski <piotr@synadia.com>
30e4fcc to
278dd07
Compare
|
@claude re-review this PR |
|
Claude finished @piotrpio's task in 2m 47s —— View job PR Re-Review: Fast publish initial design
Good progress — 7 of the 10 previous findings are resolved. Two design concerns remain, and I found two new issues. Previous findings: status
New Bugs1. Test error message wrong in if ack.BatchSize != 201 {
t.Fatalf("Expected BatchAck.BatchSize to be 21, got %d", ack.BatchSize)
}Condition checks 2. Uppercase error string in fp.errHandler(fmt.Errorf("Error processing batch at sequence %d: %w", flowErr.Sequence, flowErr.Error))Go convention (and all other error messages in this file) is lowercase. Should be Remaining Design Concerns4. Error handler called while holding The 7. Dead subscribe fallback in if fp.ackSub == nil {
ackSub, err := fp.js.Conn().Subscribe(...)
// ...
}
Minor Nit
|
|
@claude re-review this PR
|
|
Claude finished @piotrpio's task in 2m 26s —— View job PR Re-Review: Fast publish initial design
All previously open bugs are resolved, and the user-dismissed design concerns (#4 error handler under lock, #7 dead subscribe fallback, redundant Previous findings: final status
New Nits1. Remaining fast-batch error descriptions missing "fast" prefix — The same issue fixed for // errors.go:85
ErrFastBatchInvalidPattern: Description: "batch publish invalid pattern used"
// errors.go:88
ErrFastBatchInvalidID: Description: "batch publish ID is invalid (exceeds 64 characters)"
// errors.go:91
ErrFastBatchUnknownID: Description: "batch publish ID is unknown"All three should read 2.
Overall the implementation is solid. The flow-control mechanism, ping/retry logic, and cleanup paths are well handled. Ready to merge once the description nits are addressed. |
No description provided.