Skip to content

Commit

Permalink
Remove kafka consumer panic
Browse files Browse the repository at this point in the history
  • Loading branch information
trunghai95 committed Nov 1, 2023
1 parent f0e910c commit 5fb9a49
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions coinmiddleware/kafkaconsumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,18 @@ func (c *kafkaConsumerImpl) Start(ctx context.Context) {
err := c.client.Consume(ctx, c.topics, c.handler)
if err != nil {
log.Errorf("kafka consumer error: %v", err)
if errors.Is(err, sarama.ErrClosedConsumerGroup) {
err = nil
}
err = errors.Wrap(err, "kafka consumer error")
panic(err)
//if errors.Is(err, sarama.ErrClosedConsumerGroup) {
// err = nil
//}
//err = errors.Wrap(err, "kafka consumer error")
//panic(err)
return
}
if err = ctx.Err(); err != nil {
log.Errorf("kafka consumer ctx error: %v", err)
err = errors.Wrap(err, "kafka consumer ctx error")
panic(err)
//err = errors.Wrap(err, "kafka consumer ctx error")
//panic(err)
return
}
}
}
Expand Down

0 comments on commit 5fb9a49

Please sign in to comment.