From 26283578272ea51690f567e333b24159a7db9896 Mon Sep 17 00:00:00 2001 From: parabala Date: Fri, 30 Aug 2024 18:09:07 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=90=8E=E7=AB=AF=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E8=B6=85=E6=97=B6=E6=97=B6=E9=97=B4=E5=85=81=E8=AE=B8=E6=9C=80?= =?UTF-8?q?=E5=B0=8F20ms?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- endpoint/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/endpoint/src/lib.rs b/endpoint/src/lib.rs index df1323e8b..417387b84 100644 --- a/endpoint/src/lib.rs +++ b/endpoint/src/lib.rs @@ -39,7 +39,7 @@ impl Timeout { me } pub fn adjust(&mut self, ms: u32) { - self.ms = ms.max(100).min(6000) as u16; + self.ms = ms.max(20).min(6000) as u16; } pub fn to(mut self, ms: u32) -> Self { if ms > 0 { From b6f55786e745fc4780f1a3d68f016e8723f9c5ed Mon Sep 17 00:00:00 2001 From: parabala Date: Tue, 3 Sep 2024 15:24:00 +0800 Subject: [PATCH 2/2] =?UTF-8?q?timeout=E6=9C=80=E5=B0=8F=E5=80=BC=E3=80=81?= =?UTF-8?q?=E6=9C=80=E5=A4=A7=E5=80=BC=E7=94=A8=E5=B8=B8=E9=87=8F=E8=A1=A8?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- endpoint/src/lib.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/endpoint/src/lib.rs b/endpoint/src/lib.rs index 417387b84..ee7aa726a 100644 --- a/endpoint/src/lib.rs +++ b/endpoint/src/lib.rs @@ -24,6 +24,8 @@ const TO_MYSQL_S: Timeout = Timeout::from_millis(500); const TO_VECTOR_M: Timeout = Timeout::from_millis(1000); const TO_VECTOR_S: Timeout = Timeout::from_millis(500); const TO_UUID: Timeout = Timeout::from_millis(100); +const TO_MIN_MS: u32 = 20; // timeout最小值,单位ms +const TO_MAX_MS: u32 = 6000; // timeout最大值,单位ms #[derive(Copy, Clone, Debug)] pub struct Timeout { @@ -39,7 +41,7 @@ impl Timeout { me } pub fn adjust(&mut self, ms: u32) { - self.ms = ms.max(20).min(6000) as u16; + self.ms = ms.max(TO_MIN_MS).min(TO_MAX_MS) as u16; } pub fn to(mut self, ms: u32) -> Self { if ms > 0 {