1
0
Fork 0
mirror of https://code.forgejo.org/forgejo/runner.git synced 2025-07-27 17:28:35 +00:00

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 {
This commit is contained in:
Earl Warren 2025-07-05 10:52:48 +02:00
parent 45fae19e5b
commit b842a66be2
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00

View file

@ -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))
}