Skip to content
Merged
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
28 changes: 6 additions & 22 deletions src/consumer/kafka.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,32 +359,16 @@ pub async fn handle_events(
unreachable!("Got partition revocation before the consumer has started")
}
(ConsumerState::Ready, Event::Shutdown) => ConsumerState::Stopped,
(ConsumerState::Consuming(handles, mut tpl), Event::Assign(mut assigned)) => {
assert!(
tpl.is_disjoint(&assigned),
"Newly assigned TPL should be disjoint from TPL we're consuming from"
);
tpl.append(&mut assigned);
debug!(
"{} additional topic partitions added after assignment",
assigned.len()
);
handles.shutdown(CALLBACK_DURATION).await;
ConsumerState::Consuming(spawn_actors(consumer.clone(), &tpl), tpl)
(ConsumerState::Consuming(_, _), Event::Assign(_)) => {
unreachable!("Got partition assignment after the consumer has started")
}
(ConsumerState::Consuming(handles, mut tpl), Event::Revoke(revoked)) => {
(ConsumerState::Consuming(handles, tpl), Event::Revoke(revoked)) => {
assert!(
tpl.is_subset(&revoked),
"Revoked TPL should be a subset of TPL we're consuming from"
tpl == revoked,
"Revoked TPL should be equal to the subset of TPL we're consuming from"
);
tpl.retain(|e| !revoked.contains(e));
debug!("{} topic partitions remaining after revocation", tpl.len());
handles.shutdown(CALLBACK_DURATION).await;
if tpl.is_empty() {
ConsumerState::Ready
} else {
ConsumerState::Consuming(spawn_actors(consumer.clone(), &tpl), tpl)
}
ConsumerState::Ready
}
(ConsumerState::Consuming(handles, _), Event::Shutdown) => {
handles.shutdown(CALLBACK_DURATION).await;
Expand Down
Loading