-
Notifications
You must be signed in to change notification settings - Fork 287
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Various BaseProducer::flush fixes (#748)
* 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`.
- Loading branch information
1 parent
bd70a6e
commit c8e48e3
Showing
4 changed files
with
91 additions
and
34 deletions.
There are no files selected for viewing
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
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
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
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