Skip to content

Minor: auto-commit-offset doesn't execute after the deadline#4794

Closed
chia7712 wants to merge 2 commits intoapache:trunkfrom
chia7712:auto_commit
Closed

Minor: auto-commit-offset doesn't execute after the deadline#4794
chia7712 wants to merge 2 commits intoapache:trunkfrom
chia7712:auto_commit

Conversation

@chia7712
Copy link
Copy Markdown
Member

one line fix. The callback may take some time to execute so updating the current time is necessary.

Committer Checklist (excluded from commit message)

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation (including upgrade notes)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good find. Perhaps to save unneeded calls to system time, we could let invokeCompletedOffsetCommitCallbacks return a boolean to indicate whether any callbacks which invoked?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Will address your comment.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hachikuji Would you please take a look?

Copy link
Copy Markdown
Contributor

@hachikuji hachikuji left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, just a minor question.

@Test
public void testAutoCommitAfterInvokingOffsetCommitCallback() throws InterruptedException {
final List<Long> committedOffset = new ArrayList<>();
ConsumerInterceptor ci = new ConsumerInterceptor<Object, Object>() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the advantage to doing this in an interceptor instead of the OffsetCommitCallback?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ut use interceptor to collect all successful offsets. The OffsetCommitCallback is invoked only once so it can't be substituted for interceptor.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hachikuji any comments about the tests? thanks.

@chia7712
Copy link
Copy Markdown
Member Author

#5087 had resolved this issue.

@chia7712 chia7712 closed this Feb 24, 2019
@chia7712 chia7712 deleted the auto_commit branch March 25, 2024 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants