From cb6d74d19041c6a610f15b23f9ab3764fcbac919 Mon Sep 17 00:00:00 2001 From: Cocoon-break <1933384762@qq.com> Date: Mon, 2 Nov 2026 16:07:42 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=8F=91=E7=89=88=EF=BC=9A=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E5=8F=B7=E5=8D=87=E5=88=B0=200.5.3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 --- Cargo.lock | 6 +++--- Cargo.toml | 2 +- package.json | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6e52ee0..50e8daa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5800,7 +5800,7 @@ checksum = "b9cc00251562a284751c9973bace760d86c0276c471b4be569fe6b068ee97a56" [[package]] name = "xpaste" -version = "0.5.2" +version = "0.5.3" dependencies = [ "chrono", "embed-resource", @@ -5830,7 +5830,7 @@ dependencies = [ [[package]] name = "xpaste-core" -version = "0.5.2" +version = "0.5.3" dependencies = [ "chrono", "image", @@ -5845,7 +5845,7 @@ dependencies = [ [[package]] name = "xpaste-platform" -version = "0.5.2" +version = "0.5.3" dependencies = [ "block2", "dispatch2", diff --git a/Cargo.toml b/Cargo.toml index 336010f..ef7b563 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ resolver = "3" members = ["src-tauri", "crates/xpaste-core", "crates/xpaste-platform"] [workspace.package] -version = "0.5.2" +version = "0.5.3" edition = "2024" rust-version = "1.90" diff --git a/package.json b/package.json index 8b13108..1727e71 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "xpaste", "private": true, - "version": "0.5.2", + "version": "0.5.3", "type": "module", "packageManager": "pnpm@10.28.0", "scripts": { From 29d70530146b943131fb441d5d91c57044123bf8 Mon Sep 17 00:00:00 2001 From: Cocoon-break <1933384762@qq.com> Date: Mon, 2 Nov 2026 16:16:55 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=B5=8B=E8=AF=95=EF=BC=9A=E6=94=BE?= =?UTF-8?q?=E5=AE=BD=E7=94=BB=E9=9D=A2=E6=B5=81=E6=B5=8B=E8=AF=95=E7=9A=84?= =?UTF-8?q?=E7=AD=89=E5=BE=85=E4=B8=8A=E9=99=90=EF=BC=88CI=20=E7=9A=84=20m?= =?UTF-8?q?acOS=20=E6=9C=BA=E5=99=A8=E4=B8=8A=20sleep=20=E6=8B=96=E9=95=BF?= =?UTF-8?q?=EF=BC=8C=E5=81=B6=E5=8F=91=E5=A4=B1=E8=B4=A5=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit poll_stream_fails_after_repeated_errors 只等 200 ms,要等 5 次 10 ms 的失败;CI 上 sleep 常超时。 等待上限只在没满足时才用满,放到 5 s;唤醒类测试改成超时 5 s、耗时 < 2 s,仍能区分唤醒与超时。 Co-Authored-By: Claude Opus 5.5 --- crates/xpaste-platform/src/stream.rs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/crates/xpaste-platform/src/stream.rs b/crates/xpaste-platform/src/stream.rs index e8379e0..584e476 100644 --- a/crates/xpaste-platform/src/stream.rs +++ b/crates/xpaste-platform/src/stream.rs @@ -231,7 +231,7 @@ mod tests { assert!(s.next(Duration::from_millis(30)).is_none()); let e = t.elapsed(); assert!( - e >= Duration::from_millis(30) && e < Duration::from_millis(200), + e >= Duration::from_millis(30) && e < Duration::from_secs(2), "{e:?}" ); } @@ -246,8 +246,9 @@ mod tests { l2.push(frame(7)); }); let t = Instant::now(); - assert_eq!(s.next(Duration::from_secs(1)).map(|f| f.w), Some(7)); - assert!(t.elapsed() < Duration::from_millis(200)); + // 超时设得远大于上限:耗时低于上限说明是被唤醒的,不是等到了超时 + assert_eq!(s.next(Duration::from_secs(5)).map(|f| f.w), Some(7)); + assert!(t.elapsed() < Duration::from_secs(2)); h.join().unwrap(); } @@ -261,8 +262,8 @@ mod tests { l2.fail(); }); let t = Instant::now(); - assert!(s.next(Duration::from_secs(1)).is_none()); - assert!(t.elapsed() < Duration::from_millis(200)); + assert!(s.next(Duration::from_secs(5)).is_none()); + assert!(t.elapsed() < Duration::from_secs(2)); assert!(s.failed()); h.join().unwrap(); } @@ -300,7 +301,7 @@ mod tests { }, Duration::from_millis(10), ); - let f = s.next(Duration::from_millis(200)).expect("应有帧"); + let f = s.next(Duration::from_secs(5)).expect("应有帧"); assert_eq!((f.h, f.rgba.len()), (1, 4 * f.w as usize)); assert_eq!(s.mode(), "逐帧"); s.stop(); @@ -317,8 +318,9 @@ mod tests { || Err(PlatformError::Capture("x".into())), Duration::from_millis(10), ); + // 只是等待上限,满足即退出:CI 的 macOS 机器上 sleep(10ms) 常拖很久,200 ms 不够 5 次 let t = Instant::now(); - while !s.failed() && t.elapsed() < Duration::from_millis(200) { + while !s.failed() && t.elapsed() < Duration::from_secs(5) { thread::sleep(Duration::from_millis(5)); } assert!(s.failed());