File tree 1 file changed +6
-6
lines changed
1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -427,6 +427,12 @@ func (cl *Client) EndTransaction(ctx context.Context, commit TransactionEndTry)
427
427
}
428
428
}
429
429
430
+ // If no partition was added to a transaction, then we have nothing to commit.
431
+ if ! anyAdded {
432
+ cl .cfg .logger .Log (LogLevelInfo , "no records were produced during the commit; thus no transaction was began; ending without doing anything" )
433
+ return nil
434
+ }
435
+
430
436
id , epoch , err := cl .producerID ()
431
437
if err != nil {
432
438
if commit {
@@ -468,12 +474,6 @@ func (cl *Client) EndTransaction(ctx context.Context, commit TransactionEndTry)
468
474
}
469
475
}
470
476
471
- // If no partition was added to a transaction, then we have nothing to commit.
472
- if ! anyAdded {
473
- cl .cfg .logger .Log (LogLevelInfo , "no records were produced during the commit; thus no transaction was began; ending without doing anything" )
474
- return nil
475
- }
476
-
477
477
cl .cfg .logger .Log (LogLevelInfo , "ending transaction" ,
478
478
"transactional_id" , * cl .cfg .txnID ,
479
479
"producer_id" , id ,
You can’t perform that action at this time.
0 commit comments