Skip to main content

Module server_pulse

Module server_pulse 

Source
Expand description

The last pulse sent to kasl-server, and how it went. The last pulse this machine sent to kasl-server, and how it went.

The watcher sends the pulse and kasl server status reports on it, and the two are different processes: this row is how one tells the other. It holds the latest attempt and nothing behind it - the server keeps only the latest claim, and a local history of when someone was at their desk would be the very record the pulse was designed not to leave (ADR 0014 in kasl-server).

use chrono::{Duration, Utc};
use kasl::api::kasl_server::AgentState;
use kasl::db::server_pulse::ServerPulse;

let mut pulse = ServerPulse::new()?;
let now = Utc::now();
pulse.record_accepted(now, now + Duration::seconds(60), AgentState::Working, 180, 0)?;

if let Some(last) = pulse.last()? {
    println!("last attempt at {}", last.attempted_at);
}

Structsยง

PulseRecord
The latest attempt, as the watcher recorded it.
ServerPulse
Access to the pulse row.