From 2957ccf1ff638a64851b8cd5394794ba4b920ed9 Mon Sep 17 00:00:00 2001 From: Nahuel Lofeudo Date: Sun, 24 May 2026 08:04:39 +0100 Subject: [PATCH] Use configured seconds for timing --- src/gtfs/structs.rs | 2 +- src/main.rs | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/gtfs/structs.rs b/src/gtfs/structs.rs index b6eb058..f1bb8f9 100644 --- a/src/gtfs/structs.rs +++ b/src/gtfs/structs.rs @@ -24,7 +24,7 @@ pub struct Preferences { pub realtime_api_key: String, #[serde(rename = "refresh-seconds")] - pub refresh_seconds: u32, + pub refresh_seconds: u64, } diff --git a/src/main.rs b/src/main.rs index 4981c9b..f0c374d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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() {