Skip to content

Commit

Permalink
fix(v3): race condition set AllowAutoTopicCreation (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
leowind committed May 13, 2024
1 parent 260a52a commit 2c8972d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion v3/kafka.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,6 @@ func (client *KafkaClient) publishEvent(ctx context.Context, topic, eventName st

config.Topic = topic
writer = client.getWriter(config)
writer.AllowAutoTopicCreation = true
err = writer.WriteMessages(ctx, message)
if err != nil {
if errors.Is(err, io.ErrClosedPipe) {
Expand Down Expand Up @@ -663,6 +662,7 @@ func (client *KafkaClient) getWriter(config kafka.WriterConfig) *kafka.Writer {
}

writer := kafka.NewWriter(config)
writer.AllowAutoTopicCreation = true
client.writers[config.Topic] = writer

return writer
Expand Down

0 comments on commit 2c8972d

Please sign in to comment.