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

feat: use a rolling timer rather than a simple time.Ticker in batch consumer #154

Open
Abdulsametileri opened this issue Dec 21, 2024 · 1 comment
Assignees

Comments

@Abdulsametileri
Copy link
Member

Rolling Timer

  • Use time.NewTimer(...) instead of time.NewTicker(...)
  • Reset this timer every time you receive a message (to extend the flush deadline).
  • If the timer expires (i.e., case <-flushTimer.C:), flush whatever messages have accumulated.

That way, for “hot” topics (lots of messages in short intervals), the timer keeps resetting and you primarily flush on message-count/byte-size constraints. For slower topics, you’ll flush after no new messages arrive within messageGroupDuration.

@Abdulsametileri Abdulsametileri self-assigned this Dec 21, 2024
@Abdulsametileri
Copy link
Member Author

implemented, and currently I am testing
#156

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

No branches or pull requests

1 participant