Skip to content

Commit

Permalink
fix: added Errors() read from kafkaSensor's producer
Browse files Browse the repository at this point in the history
Signed-off-by: AmitMendl <[email protected]>
  • Loading branch information
MenD32 committed Dec 29, 2023
1 parent 0c071e7 commit e31c0d7
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 e31c0d7

Please sign in to comment.