Use configured seconds for timing

This commit is contained in:
Nahuel Lofeudo 2026-05-24 08:04:39 +01:00
parent a48ddfc9b7
commit 2957ccf1ff
2 changed files with 2 additions and 4 deletions

View File

@ -24,7 +24,7 @@ pub struct Preferences {
pub realtime_api_key: String,
#[serde(rename = "refresh-seconds")]
pub refresh_seconds: u32,
pub refresh_seconds: u64,
}

View File

@ -9,8 +9,6 @@ use crate::{config::load_config, gtfs::structs::{Arrival, Gtfs}, renderer::struc
const SRC_FILE: &str = "/home/nahuel/Downloads/GTFS_Realtime.zip";
const NUM_ARRIVALS: usize = 4;
const UPDATE_INTERVAL_SECONDS: u64 = 62;
// Custom Event to signal data refresh
#[derive(Debug)]
@ -122,7 +120,7 @@ fn main() {
.name("updater".to_string())
.spawn(move || {
loop {
std::thread::sleep(std::time::Duration::new(UPDATE_INTERVAL_SECONDS,0));
std::thread::sleep(std::time::Duration::new(gtfs_prefs.refresh_seconds,0));
let event = RefreshDataEvent {};
let send_result = event_sender.push_custom_event(event);
if send_result.is_err() {