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

Improve performances when wait_before_drop is 0 #1480

Merged
merged 1 commit into from
Sep 27, 2024
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
10 changes: 7 additions & 3 deletions io/zenoh-transport/src/common/pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ impl StageIn {
&mut self,
msg: &mut NetworkMessage,
priority: Priority,
deadline_before_drop: Option<Instant>,
deadline_before_drop: Option<Option<Instant>>,
) -> bool {
// Lock the current serialization batch.
let mut c_guard = self.mutex.current();
Expand All @@ -163,7 +163,7 @@ impl StageIn {
Some(deadline) if !$fragment => {
// We are in the congestion scenario and message is droppable
// Wait for an available batch until deadline
if !self.s_ref.wait_deadline(deadline) {
if !deadline.map_or(false, |deadline| self.s_ref.wait_deadline(deadline)) {
// Still no available batch.
// Restore the sequence number and drop the message
$restore_sn;
Expand Down Expand Up @@ -628,7 +628,11 @@ impl TransmissionPipelineProducer {
};
// If message is droppable, compute a deadline after which the sample could be dropped
let deadline_before_drop = if msg.is_droppable() {
Some(Instant::now() + self.wait_before_drop)
if self.wait_before_drop.is_zero() {
Some(None)
} else {
Some(Some(Instant::now() + self.wait_before_drop))
}
} else {
None
};
Expand Down
Loading