heetch / felice

Felice is a nascent, opinionated Kafka library for Go, in Go
MIT License
20 stars 1 forks source link

Panics if configuration is not set #43

Closed yaziine closed 5 years ago

yaziine commented 5 years ago

There are panics that should be fixed.

The first one is in the setup method when trying to retrieve the MaxRetryInterval configuration when c.config is nil. https://github.com/heetch/felice/blob/4aa9633649f00575adc667afb14331bebd65f760/consumer/consumer.go#L91

The second one is involved by fixing the first one: calling setup when c.config is nil won't create the c.retryStrategy. This ends with panic when using it in retry.StartWithCancel. We should create the config before calling setup in the Serve method. https://github.com/heetch/felice/blob/4aa9633649f00575adc667afb14331bebd65f760/consumer/consumer.go#L213

The third one is the panic("unreachable"), when sending SIGINT to the consumer, this piece of code is reachable. We should return a nil Message to close the consumer. https://github.com/heetch/felice/blob/4aa9633649f00575adc667afb14331bebd65f760/consumer/consumer.go#L242