Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A few minor offset-manager tweaks #522

Merged
merged 1 commit into from
Aug 24, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ type Config struct {
// Offsets specifies configuration for how and when to commit consumed offsets. This currently requires the
// manual use of an OffsetManager but will eventually be automated.
Offsets struct {
// How frequently to commit updated offsets. Defaults to 10s.
// How frequently to commit updated offsets. Defaults to 1s.
CommitInterval time.Duration

// The initial offset to use if no offset was previously committed. Should be OffsetNewest or OffsetOldest.
Expand Down Expand Up @@ -175,7 +175,7 @@ func NewConfig() *Config {
c.Consumer.MaxWaitTime = 250 * time.Millisecond
c.Consumer.MaxProcessingTime = 100 * time.Millisecond
c.Consumer.Return.Errors = false
c.Consumer.Offsets.CommitInterval = 10 * time.Second
c.Consumer.Offsets.CommitInterval = 1 * time.Second
c.Consumer.Offsets.Initial = OffsetNewest

c.ChannelBufferSize = 256
Expand Down
8 changes: 5 additions & 3 deletions offset_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,9 +311,11 @@ func (pom *partitionOffsetManager) MarkOffset(offset int64, metadata string) {
pom.lock.Lock()
defer pom.lock.Unlock()

pom.offset = offset
pom.metadata = metadata
pom.dirty = true
if offset > pom.offset {
pom.offset = offset
pom.metadata = metadata
pom.dirty = true
}
}

func (pom *partitionOffsetManager) updateCommitted(offset int64, metadata string) {
Expand Down