mirror of
https://github.com/stakwork/sphinx-key.git
synced 2026-02-11 02:34:45 +01:00
sphinx-key: delete standalone heartbeat loop
just pulse the hearbeat everytime expected_sequence % 40 == 0
This commit is contained in:
@@ -34,7 +34,6 @@ pub enum Event {
|
||||
VlsMessage(Vec<u8>),
|
||||
LssMessage(Vec<u8>),
|
||||
Control(Vec<u8>),
|
||||
HeartBeat,
|
||||
}
|
||||
|
||||
pub const ROOT_STORE: &str = "/sdcard/store";
|
||||
@@ -147,6 +146,12 @@ pub fn make_event_loop(
|
||||
let flash_db = ctrlr.persister();
|
||||
let mut expected_sequence = None;
|
||||
while let Ok(event) = rx.recv() {
|
||||
if let Some(seq) = expected_sequence {
|
||||
if seq % 40 == 0 {
|
||||
log::info!("get heartbeat!");
|
||||
let _ = root_handler.node().get_heartbeat();
|
||||
}
|
||||
}
|
||||
match event {
|
||||
Event::Connected => {
|
||||
log::info!("GOT A Event::Connected msg!");
|
||||
@@ -160,10 +165,6 @@ pub fn make_event_loop(
|
||||
led_tx.send(Status::ConnectingToMqtt).unwrap();
|
||||
log::info!("GOT A Event::Disconnected msg!");
|
||||
}
|
||||
Event::HeartBeat => {
|
||||
log::info!("Beating the heart!");
|
||||
let _ = root_handler.node().get_heartbeat();
|
||||
}
|
||||
Event::VlsMessage(msg_bytes) => {
|
||||
led_tx.send(Status::Signing).unwrap();
|
||||
let state1 = approver.control().get_state();
|
||||
|
||||
@@ -193,12 +193,6 @@ fn make_and_launch_client(
|
||||
log::info!(">>>>>>>>>>> blocking forever...");
|
||||
log::info!("{:?}", config);
|
||||
|
||||
// heartbeat loop
|
||||
thread::spawn(move || loop {
|
||||
thread::sleep(Duration::from_secs(60));
|
||||
let _ = tx.send(Event::HeartBeat);
|
||||
});
|
||||
|
||||
make_event_loop(
|
||||
mqtt_client,
|
||||
rx,
|
||||
|
||||
Reference in New Issue
Block a user