File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -600,9 +600,12 @@ func (w *Writer) Close() error {
600
600
//
601
601
// The context passed as first argument may also be used to asynchronously
602
602
// cancel the operation. Note that in this case there are no guarantees made on
603
- // whether messages were written to kafka. The program should assume that the
604
- // whole batch failed and re-write the messages later (which could then cause
605
- // duplicates).
603
+ // whether messages were written to kafka, they might also still be written
604
+ // after this method has already returned, therefore it is important to not
605
+ // modify byte slices of passed messages if WriteMessages returned early due
606
+ // to a canceled context.
607
+ // The program should assume that the whole batch failed and re-write the
608
+ // messages later (which could then cause duplicates).
606
609
func (w * Writer ) WriteMessages (ctx context.Context , msgs ... Message ) error {
607
610
if w .Addr == nil {
608
611
return errors .New ("kafka.(*Writer).WriteMessages: cannot create a kafka writer with a nil address" )
You can’t perform that action at this time.
0 commit comments