-
Notifications
You must be signed in to change notification settings - Fork 186
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
Discard message after rebalance #223
Discard message after rebalance #223
Conversation
…o discard_message_after_rebalance
@@ -158,6 +160,9 @@ cdef class StreamIterator: | |||
offset = message.offset | |||
consumer = self.consumer | |||
|
|||
if message.generation_id != self.app.consumer_generation_id: | |||
return None, self._skipped_value, stream_state |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we log this?
@@ -974,6 +974,9 @@ async def _py_aiter(self) -> AsyncIterator[T_co]: | |||
tp = message.tp | |||
offset = message.offset | |||
|
|||
if message.generation_id != self.app.consumer_generation_id: | |||
value = skipped_value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we log this? It will be easier to debug if this were to happen
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea
Codecov Report
@@ Coverage Diff @@
## master #223 +/- ##
==========================================
- Coverage 94.40% 94.37% -0.04%
==========================================
Files 100 100
Lines 10740 10749 +9
Branches 1214 1215 +1
==========================================
+ Hits 10139 10144 +5
- Misses 536 539 +3
- Partials 65 66 +1
Continue to review full report at Codecov.
|
Description
Fixes #221
This PR introduces two changes to avoid processing of events fetched before a rebalance:
consumer.stop_flow
is calledgeneration_id
toMessage
to support skipping events with a generation_id not matching the current generation_id.