Sarama: non-positive interval for NewTicker

Created on 11 Mar 2020  ·  8Comments  ·  Source: Shopify/sarama

Versions

Please specify real version numbers or git SHAs, not just "Latest" since that changes fairly regularly.

| Sarama | Kafka | Go |
|--------|-------|----|
v1.26.1 | Amazon MSK 2.2.0 | 1.13.5
-- | -- | --

| | | |
panic: non-positive interval for NewTicker

ticker := time.NewTicker(c.client.config.Consumer.Offsets.CommitInterval)

// Deprecated: CommitInterval exists for historical compatibility
// and should not be used. Please use Consumer.Offsets.AutoCommit
CommitInterval time.Duration

How can I set this CommitInterval?

Most helpful comment

seems like a bug, got similar issue. I've worked around it by doing this:
clusterConfig.Consumer.Offsets.CommitInterval = time.Second

All 8 comments

seems like a bug, got similar issue. I've worked around it by doing this:
clusterConfig.Consumer.Offsets.CommitInterval = time.Second

I have the same issue. Seems like a regression in 1.26.1
Setting Consumer.Offsets.CommitInterval to 1 seems to get it running again.

Me too. I use "github.com/bsm/sarama-cluster" with kafka consumer group feature

Use this github.com/bsm/sarama-cluster v2.1.15+incompatible

@soouCc have you tried using the following with a recent Sarama release?

    config.Consumer.Offsets.AutoCommit.Interval = 1 * time.Second

@d1egoaz

  config.Consumer.Offsets.AutoCommit.Interval = 1 * time.Second

Hello, I try it, but it doesn't work.

  clusterConfig.Consumer.Offsets.CommitInterval = time.Second

This works

clusterConfig.Consumer.Offsets.CommitInterval is deprecated

You need to use next one for fixing problem

cfg.Consumer.Offsets.AutoCommit.Enable = true
cfg.Consumer.Offsets.AutoCommit.Interval = time.Second

@d1egoaz

  config.Consumer.Offsets.AutoCommit.Interval = 1 * time.Second

Hello, I try it, but it doesn't work.

  clusterConfig.Consumer.Offsets.CommitInterval = time.Second

This works

It works if you turn on flag cfg.Consumer.Offsets.AutoCommit.Enable = true

Was this page helpful?
0 / 5 - 0 ratings

Related issues

thomaslee picture thomaslee  ·  7Comments

blackfox1983 picture blackfox1983  ·  3Comments

shanson7 picture shanson7  ·  4Comments

Zaazik picture Zaazik  ·  3Comments

dynahcatq picture dynahcatq  ·  5Comments