Use configured seconds for timing
This commit is contained in:
parent
a48ddfc9b7
commit
2957ccf1ff
|
|
@ -24,7 +24,7 @@ pub struct Preferences {
|
||||||
pub realtime_api_key: String,
|
pub realtime_api_key: String,
|
||||||
|
|
||||||
#[serde(rename = "refresh-seconds")]
|
#[serde(rename = "refresh-seconds")]
|
||||||
pub refresh_seconds: u32,
|
pub refresh_seconds: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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 SRC_FILE: &str = "/home/nahuel/Downloads/GTFS_Realtime.zip";
|
||||||
const NUM_ARRIVALS: usize = 4;
|
const NUM_ARRIVALS: usize = 4;
|
||||||
const UPDATE_INTERVAL_SECONDS: u64 = 62;
|
|
||||||
|
|
||||||
|
|
||||||
// Custom Event to signal data refresh
|
// Custom Event to signal data refresh
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
|
@ -122,7 +120,7 @@ fn main() {
|
||||||
.name("updater".to_string())
|
.name("updater".to_string())
|
||||||
.spawn(move || {
|
.spawn(move || {
|
||||||
loop {
|
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 event = RefreshDataEvent {};
|
||||||
let send_result = event_sender.push_custom_event(event);
|
let send_result = event_sender.push_custom_event(event);
|
||||||
if send_result.is_err() {
|
if send_result.is_err() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue