Skip to content

Fix producer::flush behavior and tests #777

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

fede1024
Copy link
Owner

Also:

  • Make it easier to pass extra arguments to the test suite (./test_suite.sh -- --nocapture for example);
  • Implement fmt::Debug for Metadata;
  • Set up logging during producer tests.
  • Fix docs warnings.

Also:
* Make it easier to pass extra arguments to the test suite
  (`./test_suite.sh -- --nocapture` for example);
* Implement fmt::Debug for Metadata;
* Set up logging during producer tests.
* Fix docs warnings.
@fede1024 fede1024 requested a review from davidblewett June 21, 2025 14:36
if ret.is_error() {
return Err(KafkaError::Flush(ret.into()));
loop {
match unsafe { rdsys::rd_kafka_flush(self.native_ptr(), 0) } {
Copy link
Collaborator

Choose a reason for hiding this comment

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

It seems like the non blocking call should be on poll, not on rd_kafka_flush? This would allow the majority of the time to be spent on actually flushing the queues, and poll would just process everything that's ready?

Suggested change
match unsafe { rdsys::rd_kafka_flush(self.native_ptr(), 0) } {
match unsafe { rdsys::rd_kafka_flush(self.native_ptr(), deadline.remaining().min(Duration::from_millis(100))) } {

There was this ticket regarding special casing rd_kafka_flush with a timeout of 0 though: confluentinc/librdkafka#1950 . The underlying implementation has changed significantly since that issue was resolved so I'm not sure if that's still valid.

Copy link
Collaborator

@davidblewett davidblewett Jun 23, 2025

Choose a reason for hiding this comment

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

If this change is made, I think the logic around deciding when to poll might need adjusting too.

Co-authored-by: Rodrigo Bernardi <rodrigo@rbernardi.dev>
Co-authored-by: David Blewett <david.blewett@datadoghq.com>
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.

3 participants