@team-agent/installer 0.5.20 → 0.5.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Cargo.lock +1 -1
- package/Cargo.toml +1 -1
- package/crates/team-agent/src/coordinator/backoff.rs +31 -1
- package/package.json +4 -4
package/Cargo.lock
CHANGED
package/Cargo.toml
CHANGED
|
@@ -552,7 +552,19 @@ fn sleep_seconds(seconds: f64) {
|
|
|
552
552
|
if seconds <= 0.0 {
|
|
553
553
|
return;
|
|
554
554
|
}
|
|
555
|
-
std::
|
|
555
|
+
let deadline = std::time::Instant::now() + std::time::Duration::from_secs_f64(seconds);
|
|
556
|
+
loop {
|
|
557
|
+
#[cfg(unix)]
|
|
558
|
+
if SIGNAL_STOP_REQUESTED.load(std::sync::atomic::Ordering::SeqCst) {
|
|
559
|
+
return;
|
|
560
|
+
}
|
|
561
|
+
let now = std::time::Instant::now();
|
|
562
|
+
if now >= deadline {
|
|
563
|
+
return;
|
|
564
|
+
}
|
|
565
|
+
let remaining = deadline.saturating_duration_since(now);
|
|
566
|
+
std::thread::sleep(remaining.min(std::time::Duration::from_millis(100)));
|
|
567
|
+
}
|
|
556
568
|
}
|
|
557
569
|
|
|
558
570
|
/// 子进程退出错误(daemon bin 顶层用 anyhow,但 lib 入口仍给 typed)。
|
|
@@ -661,4 +673,22 @@ mod tests {
|
|
|
661
673
|
"panic marker must carry a backtrace; event={panic_event}"
|
|
662
674
|
);
|
|
663
675
|
}
|
|
676
|
+
|
|
677
|
+
#[cfg(unix)]
|
|
678
|
+
#[test]
|
|
679
|
+
fn signal_stop_request_interrupts_daemon_sleep_without_consuming_signal() {
|
|
680
|
+
SIGNAL_STOP_NUMBER.store(libc::SIGTERM, std::sync::atomic::Ordering::SeqCst);
|
|
681
|
+
SIGNAL_STOP_REQUESTED.store(true, std::sync::atomic::Ordering::SeqCst);
|
|
682
|
+
|
|
683
|
+
let started = std::time::Instant::now();
|
|
684
|
+
sleep_seconds(1.0);
|
|
685
|
+
let elapsed = started.elapsed();
|
|
686
|
+
let signal = take_signal_stop_request();
|
|
687
|
+
|
|
688
|
+
assert_eq!(signal, Some("SIGTERM"));
|
|
689
|
+
assert!(
|
|
690
|
+
elapsed < std::time::Duration::from_millis(500),
|
|
691
|
+
"daemon sleep must wake promptly after SIGTERM stop flag; elapsed={elapsed:?}"
|
|
692
|
+
);
|
|
693
|
+
}
|
|
664
694
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@team-agent/installer",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.21",
|
|
4
4
|
"description": "npx installer for Team Agent",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"codex",
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
"team-agent-installer": "npm/install.mjs"
|
|
21
21
|
},
|
|
22
22
|
"optionalDependencies": {
|
|
23
|
-
"@team-agent/cli-darwin-arm64": "0.5.
|
|
24
|
-
"@team-agent/cli-darwin-x64": "0.5.
|
|
25
|
-
"@team-agent/cli-linux-x64": "0.5.
|
|
23
|
+
"@team-agent/cli-darwin-arm64": "0.5.21",
|
|
24
|
+
"@team-agent/cli-darwin-x64": "0.5.21",
|
|
25
|
+
"@team-agent/cli-linux-x64": "0.5.21"
|
|
26
26
|
},
|
|
27
27
|
"scripts": {
|
|
28
28
|
"postinstall": "node npm/bincheck.mjs",
|