This repository was archived by the owner on Jun 23, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,8 @@ type Config struct {
2222 KeyCodec codec.Codec
2323}
2424
25+ const defaultRetryInterval = 5 * time .Second
26+
2527// NewConfig creates a config with sane defaults.
2628// The Sarama Cluster group mode will always be overwritten by the consumer
2729// and thus cannot be changed, as the consumer is designed to use the ConsumerModePartitions mode.
@@ -40,7 +42,6 @@ func NewConfig(clientID string) Config {
4042 c .Group .Mode = cluster .ConsumerModePartitions
4143
4244 // Felice consumer configuration
43- c .MaxRetryInterval = 5 * time .Second
4445 c .KeyCodec = codec .String () // defaults to String
4546 return c
4647}
Original file line number Diff line number Diff line change @@ -85,6 +85,9 @@ func (c *Consumer) setup() {
8585 // Note: the logic in handleMsg assumes that
8686 // this does not terminate; be aware of that when changing
8787 // this strategy.
88+ if c .config .MaxRetryInterval <= 0 {
89+ c .config .MaxRetryInterval = defaultRetryInterval
90+ }
8891 c .retryStrategy = retry.Exponential {
8992 Initial : time .Millisecond ,
9093 Factor : 2 ,
You can’t perform that action at this time.
0 commit comments