Skip to content

Commit

Permalink
fix: added Errors() read from kafkaSensor's producer (#2959)
Browse files Browse the repository at this point in the history
Signed-off-by: AmitMendl <amit.mendelevitch@gmail.com>
  • Loading branch information
AmitMendl committed Jan 1, 2024
1 parent a4407d7 commit bec39df
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions eventbus/kafka/sensor/kafka_sensor.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,13 @@ func (s *KafkaSensor) Initialize() error {
return err
}

// producer is at risk of deadlocking if Errors channel isn't read.
go func() {
for err := range producer.Errors() {
s.Logger.Errorf("Kafka producer error", zap.Error(err))
}
}()

s.client = client
s.consumer = consumer
s.kafkaHandler = &KafkaHandler{
Expand Down

0 comments on commit bec39df

Please sign in to comment.