Skip to content

Commit e656fce

Browse files
committed
fix cpu 100% issue
1 parent f8a678a commit e656fce

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "pm2-web-rust"
3-
version = "0.1.2"
3+
version = "0.1.3"
44
edition = "2021"
55

66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

src/pm2.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -131,14 +131,12 @@ impl PM2 {
131131
data: list,
132132
time: unwrap_or_sleep!(SystemTime::now().duration_since(UNIX_EPOCH)).as_millis(),
133133
};
134-
134+
let j = unwrap_or_sleep!(serde_json::to_string(&data));
135135
let sleep = sleep(Duration::from_secs(1));
136136
pin!(sleep);
137137
tokio::select! {
138-
_ = stats_chan.send(unwrap_or_sleep!(serde_json::to_string(&data))) => {},
139-
_ = &mut sleep => {
140-
break;
141-
}
138+
_ = stats_chan.send(j) => (),
139+
_ = &mut sleep => ()
142140
}
143141
tokio::time::sleep(interval).await;
144142
}

0 commit comments

Comments
 (0)