Update dependencies

This commit is contained in:
FliegendeWurst 2021-02-27 10:08:40 +01:00
parent fb5f119de1
commit be147764ea
4 changed files with 317 additions and 575 deletions

870
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -6,9 +6,9 @@ license = "GPL-3.0+"
edition = "2018" edition = "2018"
[dependencies] [dependencies]
tokio = { version = "0.2.22", features = ["full"] } tokio = { version = "1.2.0", features = ["full"] }
telegram-bot = "0.7.0" telegram-bot = { git = "https://github.com/telegram-rs/telegram-bot", rev = "07a9f9a1c76eaab2259bdc6241691187a46d69d1" }
reqwest = { version = "0.10.4", features = ["json", "blocking"] } reqwest = { version = "0.11.1", features = ["json", "blocking"] }
chrono = { version = "0.4.11", features = ["serde"] } chrono = { version = "0.4.11", features = ["serde"] }
url = "2.1.0" url = "2.1.0"
futures-util = "0.3.4" futures-util = "0.3.4"

View File

@ -59,6 +59,8 @@ pub enum Error {
Network(#[from] reqwest::Error), Network(#[from] reqwest::Error),
#[error("telegram error: {0}")] #[error("telegram error: {0}")]
Telegram(#[from] telegram_bot::Error), Telegram(#[from] telegram_bot::Error),
#[error("json parsing error: {0}")]
Json(#[from] serde_json::Error),
#[error("mime parsing error: {0}")] #[error("mime parsing error: {0}")]
Mime(#[from] mime::FromStrError), Mime(#[from] mime::FromStrError),
#[error("chrono parsing error: {0}")] #[error("chrono parsing error: {0}")]

View File

@ -237,9 +237,9 @@ async fn event_alerts() {
println!("error: {}", e); println!("error: {}", e);
} }
while Local::now().minute() == last_min { while Local::now().minute() == last_min {
tokio::time::delay_for(Duration::from_secs(1)).await; tokio::time::sleep(Duration::from_secs(1)).await;
} }
tokio::time::delay_for(Duration::from_secs(16)).await; tokio::time::sleep(Duration::from_secs(16)).await;
} }
} }
@ -250,7 +250,8 @@ async fn event_alerts_soon() -> Result<(), Error> {
let events: Result<Vec<Event>, _> = serde_json::from_str(&text); let events: Result<Vec<Event>, _> = serde_json::from_str(&text);
if events.is_err() { if events.is_err() {
eprintln!("failed to parse {}", text); eprintln!("failed to parse {}", text);
return events.into(); events?;
unreachable!() // needed to please the borrow checker
} }
let events = events.unwrap(); let events = events.unwrap();
for event in events { for event in events {
@ -286,9 +287,9 @@ async fn task_alerts() {
println!("error: {}", e); println!("error: {}", e);
} }
while Local::now().minute() == last_min { while Local::now().minute() == last_min {
tokio::time::delay_for(Duration::from_secs(1)).await; tokio::time::sleep(Duration::from_secs(1)).await;
} }
tokio::time::delay_for(Duration::from_secs(1)).await; tokio::time::sleep(Duration::from_secs(1)).await;
} }
} }
@ -299,7 +300,8 @@ async fn task_alerts_soon() -> Result<(), Error> {
let tasks: Result<Vec<Task>, _> = serde_json::from_str(&text); let tasks: Result<Vec<Task>, _> = serde_json::from_str(&text);
if tasks.is_err() { if tasks.is_err() {
eprintln!("failed to parse {}", text); eprintln!("failed to parse {}", text);
return tasks.into(); tasks?;
unreachable!() // needed to please the borrow checker
} }
let tasks = tasks.unwrap(); let tasks = tasks.unwrap();
'task: for task in tasks { 'task: for task in tasks {