From 169bff65e5f25510e0e6ffacb20740c1c95b5683 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Thu, 27 Jun 2024 19:36:37 +0500 Subject: [PATCH] Tune idle timeout (#55) --- CHANGES.md | 4 ++++ Cargo.toml | 2 +- src/dispatcher.rs | 6 +++--- src/sndlink.rs | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 790aa23..b2c7014 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,9 @@ # Changes +## [3.0.2] - 2024-06-27 + +* Tune idle timeout + ## [3.0.1] - 2024-06-04 * Better handling "session end" for inflight deliveries diff --git a/Cargo.toml b/Cargo.toml index 0593496..3b666fc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ntex-amqp" -version = "3.0.1" +version = "3.0.2" authors = ["ntex contributors "] description = "AMQP 1.0 Client/Server framework" documentation = "https://docs.rs/ntex-amqp" diff --git a/src/dispatcher.rs b/src/dispatcher.rs index f10dcef..ecd2acc 100644 --- a/src/dispatcher.rs +++ b/src/dispatcher.rs @@ -1,7 +1,6 @@ use std::collections::VecDeque; -use std::{ - cell, future::poll_fn, future::Future, marker, pin::Pin, rc::Rc, task::Context, task::Poll, -}; +use std::task::{Context, Poll}; +use std::{cell, cmp, future::poll_fn, future::Future, marker, pin::Pin, rc::Rc}; use ntex::service::{Pipeline, PipelineBinding, PipelineCall, Service, ServiceCtx}; use ntex::time::{sleep, Millis, Sleep}; @@ -48,6 +47,7 @@ where ctl_service: Pipeline, idle_timeout: Millis, ) -> Self { + let idle_timeout = Millis(cmp::min(idle_timeout.0 >> 1, 1000)); let ctl_queue = sink.get_control_queue().clone(); Dispatcher { sink, diff --git a/src/sndlink.rs b/src/sndlink.rs index 7baf625..9b41bfb 100644 --- a/src/sndlink.rs +++ b/src/sndlink.rs @@ -235,7 +235,7 @@ impl SenderLinkInner { } pub(crate) fn remote_detached(&mut self, err: AmqpProtocolError) { - log::error!( + log::trace!( "{}: Detaching sender link {:?} with error {:?}", self.session.tag(), self.name,