Check if daily heartbeat should be sent
(&self)
| 348 | |
| 349 | /// Check if daily heartbeat should be sent |
| 350 | pub fn should_send_heartbeat(&self) -> bool { |
| 351 | use chrono::Utc; |
| 352 | let today = Utc::now().format("%Y-%m-%d").to_string(); |
| 353 | |
| 354 | match self.get_entry::<String>(Table::State, HEARTBEAT_DATE_KEY) { |
| 355 | Ok(Some(last_date)) => last_date != today, |
| 356 | Ok(None) => true, // First time - definitely send |
| 357 | Err(_) => false, // Database error - don't send (might have already sent) |
| 358 | } |
| 359 | } |
| 360 | |
| 361 | /// Record that heartbeat was sent today |
| 362 | pub fn record_heartbeat_sent(&self) -> Result<(), DatabaseError> { |