This repository was archived by the owner on Jun 23, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -81,7 +81,7 @@ func (c *Consumer) setup() {
8181 }
8282 }
8383
84- if c .retryStrategy == nil {
84+ if c .config != nil && c . retryStrategy == nil {
8585 // Note: the logic in handleMsg assumes that
8686 // this does not terminate; be aware of that when changing
8787 // this strategy.
@@ -101,14 +101,14 @@ func (c *Consumer) setup() {
101101// When Serve terminates it will return an Error or nil to indicate
102102// that it excited without error.
103103func (c * Consumer ) Serve (config Config , addrs ... string ) error {
104- c .setup ()
105-
106104 c .config = & config
107105 err := c .validateConfig ()
108106 if err != nil {
109107 return err
110108 }
111109
110+ c .setup ()
111+
112112 topics := c .handlers .Topics ()
113113
114114 consumerGroup := fmt .Sprintf ("%s-consumer-group" , c .config .ClientID )
@@ -239,7 +239,8 @@ func (c *Consumer) handleMsg(msg *sarama.ConsumerMessage) (*Message, int) {
239239 }
240240 return m , attempts
241241 }
242- panic ("unreachable" )
242+ return nil , attempts
243+
243244}
244245
245246// MetricsReporter is an interface that can be passed to set metrics hook to receive metrics
You can’t perform that action at this time.
0 commit comments