Skip to content

Commit

Permalink
Fixed issues with updated dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
isaac-nls committed Sep 30, 2024
1 parent 961998c commit 26cdbd4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ version = "0.3.5"
[dependencies]
# async
async-trait = "0.1"
tokio = {version = "1.28.0", features = ["rt-multi-thread", "sync"]}
tokio = {version = "1.2", features = ["macros", "rt-multi-thread", "sync"]}


# actor framework
act-zero = {version = "0.4", features = ["default-tokio"]}
Expand All @@ -39,7 +40,7 @@ rand = "0.8"
# node information
get_if_addrs = "0.5.3"
hostname = "0.3"
sysinfo = "0.19"
sysinfo = "0.27.0"

# utils
ctrlc = {version = "3.0", features = ["termination"]}
Expand All @@ -56,4 +57,3 @@ built = "0.5"
color-eyre = "0.5"
env_logger = "0.9"
eyre = "0.6"
tokio = {version = "1.28.0", features = ["rt-multi-thread", "macros", "sync"]}
10 changes: 6 additions & 4 deletions src/channels/heartbeat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use async_nats::Message;
use async_trait::async_trait;
use log::{debug, error, info};
use std::{sync::Arc, time::Duration};
use sysinfo::{ProcessorExt, RefreshKind, System, SystemExt};
use sysinfo::{RefreshKind, CpuRefreshKind, System, SystemExt, CpuExt};

pub(crate) struct Heartbeat {
pid: Addr<Self>,
Expand Down Expand Up @@ -54,7 +54,7 @@ impl Actor for Heartbeat {
#[async_trait]
impl Tick for Heartbeat {
async fn tick(&mut self) -> ActorResult<()> {
self.system.refresh_cpu();
self.system.refresh_cpu_specifics(CpuRefreshKind::everything().without_frequency());

if self.timer.tick() {
self.timer.set_timeout_for_strong(
Expand Down Expand Up @@ -82,7 +82,9 @@ impl Heartbeat {
conn: conn.clone(),
heartbeat_interval: config.heartbeat_interval,
timer: Timer::default(),
system: System::new_with_specifics(RefreshKind::new().with_cpu()),
system: System::new_with_specifics(
RefreshKind::new().with_cpu(CpuRefreshKind::everything())
),
}
}

Expand Down Expand Up @@ -117,7 +119,7 @@ impl Heartbeat {
async fn send_heartbeat(&self) -> ActorResult<()> {
let msg = outgoing::HeartbeatMessage::new(
&self.config.node_id,
self.system.global_processor_info().cpu_usage(),
self.system.global_cpu_info().cpu_usage(),
);

send!(self
Expand Down

0 comments on commit 26cdbd4

Please sign in to comment.