From b842a66be299106ea5b317a44618e17cda74e32c Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Sat, 5 Jul 2025 10:52:48 +0200 Subject: [PATCH] fix: ReportLog retry if noMore && more rows are to be sent r.logOffset = ack ack < r.logOffset+len(rows) can be simplified as len(rows) > 0 which is only false if there were no rows to send. It follows that if noMore && ack < r.logOffset+len(rows) { is can be simplified as if noMore { is always true if rows were sent. The intent was apparently to return on error and retry if only part of the rows were sent but not all of them. To achieve that the expression is replaced with: if noMore && len(r.logRows) > 0 { --- internal/pkg/report/reporter.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/pkg/report/reporter.go b/internal/pkg/report/reporter.go index a386a43..45bc08d 100644 --- a/internal/pkg/report/reporter.go +++ b/internal/pkg/report/reporter.go @@ -310,7 +310,7 @@ func (r *Reporter) ReportLog(noMore bool) error { r.logOffset = ack r.stateMu.Unlock() - if noMore && ack < r.logOffset+len(rows) { + if noMore && len(r.logRows) > 0 { return NewErrRetry(errRetrySendAll, len(r.logRows)) }