Skip to content

Commit 5fd8870

Browse files
committed
feat(emergency-room): harden pulse with self-healing and diagnostics
1 parent 964e77b commit 5fd8870

4 files changed

Lines changed: 314 additions & 14 deletions

File tree

emergency-room/MIGRATION.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ cargo test -p emergency-room
5656
# Memory pressure / oomd observer (read-only, no process killing)
5757
./target/debug/emergency-room pulse --once
5858
./target/debug/emergency-room pulse --poll-seconds 20
59+
./target/debug/emergency-room pulse --doctor
5960
6061
# Install as user service
6162
./emergency-room/systemd/install-pulse.sh

emergency-room/rust/src/main.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ struct PulseArgs {
9292
/// Run one iteration and exit
9393
#[arg(long)]
9494
once: bool,
95+
/// Run self-diagnostics and print a health report as JSON
96+
#[arg(long)]
97+
doctor: bool,
9598
#[arg(short = 'n', long)]
9699
dry_run: bool,
97100
}
@@ -210,6 +213,14 @@ fn run_pulse(args: PulseArgs) {
210213
dry_run: args.dry_run,
211214
};
212215

216+
if args.doctor {
217+
if let Err(e) = pulse::doctor(&cfg) {
218+
eprintln!("\x1b[31m[ERROR]\x1b[0m pulse doctor failed: {e}");
219+
std::process::exit(1);
220+
}
221+
return;
222+
}
223+
213224
if let Err(e) = pulse::run(cfg) {
214225
eprintln!("\x1b[31m[ERROR]\x1b[0m pulse failed: {e}");
215226
std::process::exit(1);

0 commit comments

Comments
 (0)