Initial Commit

This commit is contained in:
2026-04-09 23:23:31 +02:00
commit a88a905d52
94 changed files with 15170 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
use sqlx::SqlitePool;
use tokio::time::{sleep, Duration};
use crate::weather::poll_weather;
pub fn start_weather_scheduler(pool: SqlitePool) {
// 3-hour weather poll
let pool_3h = pool.clone();
tokio::spawn(async move {
loop {
if let Err(e) = poll_weather(&pool_3h).await {
tracing::error!("Weather poll (3h) failed: {}", e);
}
sleep(Duration::from_secs(3 * 3600)).await;
}
});
// 15-minute dew point poll (open-meteo only)
tokio::spawn(async move {
loop {
sleep(Duration::from_secs(15 * 60)).await;
if let Err(e) = crate::weather::openmeteo::fetch_openmeteo().await {
tracing::warn!("Dew point poll failed: {}", e);
} else {
tracing::debug!("Dew point poll OK");
}
}
});
}