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

Need to Join Completed Producer Threads in Trace to Events #282

Merged
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
29 changes: 18 additions & 11 deletions trace-to-events/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,18 +138,25 @@ async fn main() -> anyhow::Result<()> {
let mut kafka_producer_thread_set = JoinSet::new();

loop {
match consumer.recv().await {
Ok(m) => {
process_kafka_message(
&tracer,
&args,
&mut kafka_producer_thread_set,
&producer,
&m,
);
consumer.commit_message(&m, CommitMode::Async).unwrap();
tokio::select! {
msg = consumer.recv() => match msg {
Ok(m) => {
process_kafka_message(
&tracer,
&args,
&mut kafka_producer_thread_set,
&producer,
&m,
);
consumer.commit_message(&m, CommitMode::Async).unwrap();
}
Err(e) => warn!("Kafka error: {}", e)
},
join_next = kafka_producer_thread_set.join_next() => {
if let Some(Err(e)) = join_next {
error!("Error Joining Kafka Producer Task: {e}");
}
}
Err(e) => warn!("Kafka error: {}", e),
}
}
}
Expand Down