-
Notifications
You must be signed in to change notification settings - Fork 287
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
Various BaseProducer::flush fixes #748
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
continue processing events until the passed timeout. Refactor `BaseProducer::flush` to spend most time in `librdkafka`, and whatever is left in `BaseProducer::poll`.
mlowicki
reviewed
Dec 10, 2024
mlowicki
reviewed
Dec 10, 2024
mlowicki
reviewed
Dec 10, 2024
timeout is `Duration::ZERO`.
`BaseProducer::poll`.
mlowicki
reviewed
Dec 11, 2024
mlowicki
reviewed
Dec 11, 2024
`Timeout::After<Duration::ZERO>` for a non-blocking call.
mlowicki
reviewed
Dec 12, 2024
mlowicki
reviewed
Dec 12, 2024
src/util.rs
Outdated
|
||
impl From<Deadline> for Timeout { | ||
fn from(d: Deadline) -> Timeout { | ||
if let Deadline::Never = d { |
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.
maybe we could use impl From<&Deadline> for Timeout
here to not duplicate the logic?
mlowicki
reviewed
Dec 12, 2024
mlowicki
approved these changes
Dec 12, 2024
mlowicki
reviewed
Dec 12, 2024
mlowicki
approved these changes
Dec 12, 2024
davidblewett
force-pushed
the
davidblewett/producer-flush
branch
from
December 12, 2024 17:03
91bf1a6
to
2672739
Compare
davidblewett
force-pushed
the
davidblewett/producer-flush
branch
from
December 12, 2024 18:44
e77b3ac
to
ad3e065
Compare
davidblewett
added a commit
that referenced
this pull request
Dec 12, 2024
* Refactor `BaseProducer::poll` to not return early, but instead continue processing events until the passed timeout. Refactor `BaseProducer::flush` to spend most time in `librdkafka`, and whatever is left in `BaseProducer::poll`. * Simplify and rely on cast truncation. * Fix logic error so that we always poll at least once even when timeout is `Duration::ZERO`. * Introduce Deadline type to simplify `BaseProducer::flush` and `BaseProducer::poll`. * Add `From<Timeout>` impl for `Deadline` * Ensure we always call `poll_event` at least once, even if we have `Timeout::After<Duration::ZERO>` for a non-blocking call. * Allow Deadline to express `Timeout::Never` losslessly. * Refactor poll loop to be more idiomatic. * Centralize clamping logic to Deadline. * Remove extraneous From impl. * Simplify `BaseProducer::poll` to rely on `From` impl. * Don't block forever in poll when flushing. * Remove this clamp, in favor of relying on remaining_millis_i32. * Ensure we always poll even if we get a timeout from flush. * Update changelog reflecting behavior change in `BaseProducer::poll`.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Refactor
BaseProducer::poll
to not return early, but instead continue processing events until the passed timeout.Refactor
BaseProducer::flush
to spend most time inlibrdkafka
, and whatever is left inBaseProducer::poll
.